public function createNew($data, $inheritsFromBase) { $relations = $this->getRelations(true); $transaction = $this->beginTransaction(); try { $this->save($data); if ($data->idTemplate) { if ($inheritsFromBase) { $template = new Template($data->idTemplate); $base = $template->getBaseFrame()->asQuery()->getResult(); if (count($base)) { $idFrameBase = $base[0]['idFrame']; $frameBase = new Frame($idFrameBase); $relations = $frameBase->getRelations(); Base::createEntityRelation($frameBase->getIdEntity(), 'rel_inheritance', $this->getIdEntity()); } } } $transaction->commit(); return $relations; } catch (\Exception $e) { $transaction->rollback(); throw new \Exception($e->getMessage()); } }