Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Duplicate ORM object with all relations and save
  • Is there a way to duplicate an ORM object with all it's relations and save it as a new record? For example I have structure like this:
    1. Building has many Sectors
    2. Sector has many Datapoints belongs to Building
    3. Datapoint belongs to Sector I would like to duplicate loaded Building model with all relations and save it as a new record. Thanks for the tips.
  • Thanks Harro!
  • There is no simple solution, as you'll have to copy all objects in the entire chain, which means recursing through all defined relations. You can clone() existing objects, but all relations (except many-to-many) will be reset.

Howdy, Stranger!

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

In this Discussion