Fixing update handling in Has_Many and Has_One relationships.

Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
Taylor Otwell
2012-04-10 11:26:03 -05:00
parent 8e988192a1
commit fda19731c5
5 changed files with 43 additions and 16 deletions

View File

@@ -19,6 +19,22 @@ class Has_One_Or_Many extends Relationship {
return $this->model->create($attributes);
}
/**
* Update a record for the association.
*
* @param array $attributes
* @return bool
*/
public function update(array $attributes)
{
if ($this->model->timestamps())
{
$attributes['updated_at'] = $this->model->get_timestamp();
}
return $this->table->update($attributes);
}
/**
* Set the proper constraints on the relationship table.
*