Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
EAV with Nested Set
ashizakp
September 2016
As i told earlier, in My POS Application, I want EAV should be attached to json with every Parent Row
But when i relating meta with ->related('meta') it is attached to it. but i cant get the value from json. in json i got 'meta' key.. contain no value.
is there any way to get all childs with eav attached to json???
Harro
September 2016
An EAV container is just a normal one-to-many relation, so I don't see why not.
// get the parent with all it's children
$parent = Model_Parent::query()->related('children')->where('id', '=', '1')->get_one();
// dump all child objects
var_dump($parent->children);
Obviously, you need to transform this result to an array with a layout you are happy with, and then convert the resulting array into json.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
September 2016