public function save($data) { $transaction = $this->beginTransaction(); try { $this->setData($data); if (!$this->isPersistent()) { $entity = new Entity(); $entity->setAlias('lu_' . $data->name . '_' . $data->idFrame); $entity->setType('LU'); $entity->save(); $this->setIdEntity($entity->getId()); } $this->setActive(true); parent::save(); $transaction->commit(); } catch (\Exception $e) { $transaction->rollback(); throw new \Exception($e->getMessage()); } }
public function updateEntry($newEntry) { $transaction = $this->beginTransaction(); try { $entity = new Entity($this->getIdEntity()); $entity->setAlias($newEntry); $entity->save(); $entry = new Entry(); $entry->updateEntry($this->getEntry(), $newEntry); $this->setEntry($newEntry); parent::save(); $transaction->commit(); } catch (\Exception $e) { $transaction->rollback(); throw new \Exception($e->getMessage()); } }
public function save($data) { $data->allowsApositional = $data->allowsApositional ?: '0'; $data->isAnnotation = $data->isAnnotation ?: '0'; $transaction = $this->beginTransaction(); try { $this->setData($data); if (!$this->isPersistent()) { $entity = new Entity(); $entity->setAlias($data->entry); $entity->setType('LT'); $entity->save(); $this->setIdEntity($entity->getId()); $entry = new Entry(); $entry->newEntry($data->entry); } parent::save(); $transaction->commit(); } catch (\Exception $e) { $transaction->rollback(); throw new \Exception($e->getMessage()); } }