/** * Store the object and its aggregates */ public function store() { // store the object itself parent::store(); // delete the related System_groupSystem_program objects $criteria = new TCriteria(); $criteria->add(new TFilter('grupo_id', '=', $this->id)); $repository = new TRepository('GrupoFuncionalidade'); $repository->delete($criteria); // store the related System_groupSystem_program objects if ($this->funcionalidades) { foreach ($this->funcionalidades as $funcionalidade) { $grupo_funcionalidade = new GrupoFuncionalidade(); $grupo_funcionalidade->funcionalidade_id = $funcionalidade->id; $grupo_funcionalidade->grupo_id = $this->id; $grupo_funcionalidade->store(); } } }