Hello. I have two models: Plant and PlantTitle Relation is one to many ($plant->titles); I want to create new records for Plant and PlantTitle at the same time. Could you suggest best way to do it. I tried:
$plant = new Plant([
'latin_title' => $this->request->getPost('latin_title'),
'creator_id' => 0,
'titles' => [new PlantTitle([
'language' => 'en',
'title' => $this->request->getPost('title'),
])]
]);
$plant->save();
Plant is created, but PlantTitle isn't. As for now I see only one solution: save Plant, then create PlantTitle with new plant_id. Does anyone know more elegant solution? Thanks
P.S.: phalcon version is 3.4.0