Search code examples
ormfuelphp

FuelPHP ORM Update via Array


The ORM in FuelPHP has an update example that looks like this:

$entry = Model_Article::find(4);
$entry->title = 'My first edit';
$entry->author = 'Total n00b';
$entry->save();

I'm wondering if there is an ability for me to update w/ something like this:

$values = array(
     'this' => $that
);

Model_Article::find(4)->save($values);

The insert ability allows for passing arrays of values:

$props = array('property' => 'something');

$new = Model_Example::forge($props)->save();

But I see no example of doing the same thing w/ the update ability.

EDIT: It appears Model_Example::find(4)->values($array)->save(); is what I'm looking for.


Solution

  • It appears Model_Example::find(4)->values($array)->save(); is what I'm looking for.