jonathangeiger / kohana-jelly

See the link below for the most up-to-date code
https://github.com/creatoro/jelly
MIT License
146 stars 34 forks source link

Set doesn't accept objects #172

Open bionicmaster opened 14 years ago

bionicmaster commented 14 years ago

When I try to set an object instead of an array, system generates me error, I need to cast my object as array to insert into my DB

bmidget commented 14 years ago

Not sure what you mean. Set takes an array of key => val params and sets them to whatever the val param was. For example, if address was a relationship in an "addresses" field:

$user->set(array(
    'primary_address' => $primary_address_jelly_record,
    'secondar_address' => $another_record,
    'email' => 'john@doe.com'
));

I don't see any problem with this.

bionicmaster commented 14 years ago

I have an object (extracted from another tables) $object->id, $object->name; when I try $anothertable->set($object) there's an error: This is not an array, then I need to do $anothertable->set((array) $object) to apply.