CodeIgniter Forums

Full Version: Datamapper update method
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hi there,

Having an issue with update one-to-many relationships with CodeIgniter/Datamapper. In my mind I had the notion that when a one-to-many relationship was updated. The existing records within the relationship table would be removed and the new relationships added. This appears not to be the case.

Using the following, adds new records to the relationship table each time:

Code:
$item->save($banners);

The relationships that are created are correct but I was expecting only the objects contained within
Code:
$banners
to be included in the relationship table not any historial items.

Is this correct functionality and if so what is the best method for making this update process work?

Thanks