Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Update using array
  • Hey guys,
    does exists a method to update a record using array and not an object?
    // Not this
    $item = Model_Test::find(1);
    $item->field1 = '1';
    $item->field2 = '2';
    $item->field3 = '3';
    $item->save();
    
    // but
    $item = Model_Test::find(1)->set(array(
       'field1' => '1',
       'field2' => '2',
       'field3' => '3',
    ))->save();
    
    
  • UPDATE : I found the method.
    $item = Model_Test::find(1)->values(array( 'field1' => '1', 'field2' => '2', 'field3' => '3', ))->save();
    

    Sorry but "values()" is not documented yet and I don't know that this method exists

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion