public function store()
 {
     //sobrescrito!
     parent::store();
     parent::saveAggregate('AlunoTurma', 'turma_id', 'matricula_aluno', $this->id, $this->alunos);
     parent::saveAggregate('TurmaDisciplina', 'turma_id', 'disciplina_id', $this->id, $this->disciplinas);
 }
Example #2
0
 public function store()
 {
     // armazena a venda
     parent::store();
     // percorre os itens da venda
     foreach ($this->itens as $item) {
         $item->id_venda = $this->id;
         // armazena o item
         $item->store();
     }
 }
Example #3
0
 public function store()
 {
     parent::store();
     $criteria = new TCriteria();
     $criteria->add(new TFilter('tb_imovel_imovel_id', '=', $this->imovel_id));
     $repository = new TRepository('ImovelProprietarios');
     $repository->delete($criteria);
     if ($this->proprietarios) {
         foreach ($this->proprietarios as $proprietario) {
             $imovelproprietarios = new ImovelProprietarios();
             $imovelproprietarios->tb_contribuinte_contribuinte_id = $proprietario->proprietarios_id;
             $imovelproprietarios->tb_imovel_imovel_id = $this->imovel_id;
             $imovelproprietarios->store();
         }
     }
 }
Example #4
0
 public function store()
 {
     // store the object itself
     parent::store();
     $criteria = new TCriteria();
     $criteria->add(new TFilter('tb_logradouros_logra_id', '=', $this->logra_id));
     $repository = new TRepository('LogradouroBairro');
     $repository->delete($criteria);
     if ($this->bairros) {
         foreach ($this->bairros as $bairro) {
             $logradourobairros = new LogradouroBairro();
             $logradourobairros->tb_bairros_bairros_id = $bairro->bairros_id;
             $logradourobairros->tb_logradouros_logra_id = $this->logra_id;
             $logradourobairros->store();
         }
     }
 }
Example #5
0
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     // delete the related Contact objects
     $criteria = new TCriteria();
     $criteria->add(new TFilter('customer_id', '=', $this->id));
     $repository = new TRepository('Contact');
     $repository->delete($criteria);
     // store the related Contact objects
     if ($this->contacts) {
         foreach ($this->contacts as $contact) {
             unset($contact->id);
             $contact->customer_id = $this->id;
             $contact->store();
         }
     }
 }
 /**
  * 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('system_group_id', '=', $this->id));
     $repository = new TRepository('SystemGroupProgram');
     $repository->delete($criteria);
     // store the related System_groupSystem_program objects
     if ($this->system_programs) {
         foreach ($this->system_programs as $system_program) {
             $system_group_system_program = new SystemGroupProgram();
             $system_group_system_program->system_program_id = $system_program->id;
             $system_group_system_program->system_group_id = $this->id;
             $system_group_system_program->store();
         }
     }
 }
Example #7
0
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     // delete the related CustomerSkill objects
     $criteria = new TCriteria();
     $criteria->add(new TFilter('customer_id', '=', $this->id));
     $repository = new TRepository('CustomerSkill');
     $repository->delete($criteria);
     // store the related CustomerSkill objects
     if ($this->skills) {
         foreach ($this->skills as $skill) {
             $customer_skill = new CustomerSkill();
             $customer_skill->skill_id = $skill->id;
             $customer_skill->customer_id = $this->id;
             $customer_skill->store();
         }
     }
 }
Example #8
0
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     // delete the related Item objects
     $criteria = new TCriteria();
     $criteria->add(new TFilter('srp_id', '=', $this->id));
     $repository = new TRepository('Item');
     $repository->delete($criteria);
     // store the related Item objects
     if ($this->items) {
         foreach ($this->items as $item) {
             unset($item->id);
             $item->srp_id = $this->id;
             $item->store();
         }
     }
 }
Example #9
0
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     parent::saveAggregate('CustomerSkill', 'customer_id', 'skill_id', $this->id, $this->skills);
     parent::saveComposite('Contact', 'customer_id', $this->id, $this->contacts);
 }
Example #10
0
 /**
  * Stores the book and the aggregates (authors, subjects, items)
  */
 public function store()
 {
     // stores the Book
     parent::store();
     // delete the aggregates
     $criteria = new TCriteria();
     $criteria->add(new TFilter('book_id', '=', $this->id));
     $repository = new TRepository('BookAuthor');
     $repository->delete($criteria);
     $repository = new TRepository('BookSubject');
     $repository->delete($criteria);
     $repository = new TRepository('Item');
     $repository->delete($criteria);
     // store the authors
     if ($this->authors) {
         foreach ($this->authors as $author) {
             $book_author = new BookAuthor();
             $book_author->book_id = $this->id;
             $book_author->author_id = $author->id;
             $book_author->store();
         }
     }
     // store the subjects
     if ($this->subjects) {
         foreach ($this->subjects as $subject) {
             $book_subject = new BookSubject();
             $book_subject->book_id = $this->id;
             $book_subject->subject_id = $subject->id;
             $book_subject->store();
         }
     }
     // store the items
     if ($this->items) {
         foreach ($this->items as $item) {
             $item->book_id = $this->id;
             $item->store();
         }
     }
 }
Example #11
0
 public function store()
 {
     parent::store();
     //parent::saveComposite('endereco','idpessoa',$this->idpessoa,$this->enderecos);
     parent::saveComposite('contato', 'idpessoa', $this->idpessoa, $this->contatos);
 }
Example #12
0
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     parent::saveAggregate('PedidosProdutos', 'pedidos_id', 'produtos_id', $this->id, $this->produtoss);
 }
Example #13
0
 /**
  * Stores the book and the aggregates (authors, subjects, items)
  */
 public function store()
 {
     // stores the Book
     parent::store();
     // delete the aggregates
     $criteria = new TCriteria();
     $criteria->add(new TFilter('book_id', '=', $this->id));
     $repository = new TRepository('BookAuthor');
     $repository->delete($criteria);
     $repository = new TRepository('BookSubject');
     $repository->delete($criteria);
     // collect persistent item ids
     if ($this->items) {
         foreach ($this->items as $item) {
             if ($item->id) {
                 $item_ids[] = $item->id;
             }
         }
     }
     // delete all items, except for those that persist
     $criteria->add(new TFilter('id', 'NOT IN', $item_ids));
     $repository = new TRepository('Item');
     $repository->delete($criteria);
     // store the authors
     if ($this->authors) {
         foreach ($this->authors as $author) {
             $book_author = new BookAuthor();
             $book_author->book_id = $this->id;
             $book_author->author_id = $author->id;
             $book_author->store();
         }
     }
     // store the subjects
     if ($this->subjects) {
         foreach ($this->subjects as $subject) {
             $book_subject = new BookSubject();
             $book_subject->book_id = $this->id;
             $book_subject->subject_id = $subject->id;
             $book_subject->store();
         }
     }
     // store the items
     if ($this->items) {
         foreach ($this->items as $item) {
             $item->book_id = $this->id;
             $item->store();
         }
     }
 }
Example #14
0
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     // delete the related ItemCessao objects
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cessao_id', '=', $this->id));
     $repository = new TRepository('ItemCessao');
     $repository->delete($criteria);
     // store the related ItemCessao objects
     if ($this->items) {
         foreach ($this->items as $item) {
             $cessao_item = new ItemCessao();
             $cessao_item->item_id = $item->id;
             $cessao_item->cessao_id = $this->id;
             $cessao_item->quantidade = $item->quantidade;
             $cessao_item->store();
         }
     }
 }
Example #15
0
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     // delete the related ItemRequisicao objects
     $criteria = new TCriteria();
     $criteria->add(new TFilter('requisicao_id', '=', $this->id));
     $repository = new TRepository('ItemRequisicao');
     $repository->delete($criteria);
     // store the related ItemRequisicao objects
     if ($this->items) {
         foreach ($this->items as $item) {
             $requisicao_item = new ItemRequisicao();
             $requisicao_item->item_id = $item->id;
             $requisicao_item->requisicao_id = $this->id;
             $requisicao_item->justificativa = $item->justificativa;
             $requisicao_item->quantidade = $item->quantidade;
             $requisicao_item->prazoEntrega = $item->prazoEntrega;
             $requisicao_item->store();
         }
     }
 }
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     parent::saveComposite('Contact', 'customer_id', $this->id, $this->contacts);
 }
Example #17
0
 /**
  * Store the member and its projects
  */
 public function store()
 {
     // stores the object itself
     parent::store();
     // delete the member_projects
     $member_project_rep = new TRepository('MemberProject');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('id_member', '=', $this->id));
     $member_project_rep->delete($criteria);
     // store member_projects
     if ($this->projects) {
         foreach ($this->projects as $project) {
             $member_project = new MemberProject();
             $member_project->id_project = $project->id;
             $member_project->id_member = $this->id;
             $member_project->store();
         }
     }
 }