Exemple #1
0
 /**
  * @param TblCompany $tblCompany
  * @param TblPerson  $tblPerson
  * @param TblType    $tblType
  * @param string     $Remark
  *
  * @return TblToCompany
  */
 public function addCompanyRelationshipToPerson(TblCompany $tblCompany, TblPerson $tblPerson, TblType $tblType, $Remark)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = new TblToCompany();
     $Entity->setServiceTblCompany($tblCompany);
     $Entity->setServiceTblPerson($tblPerson);
     $Entity->setTblType($tblType);
     $Entity->setRemark($Remark);
     $Manager->saveEntity($Entity);
     Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     return $Entity;
 }
 /**
  * @param TblCompany $tblCompany
  * @param TblPerson  $tblPerson
  * @param TblType    $tblType
  * @param string     $Remark
  *
  * @return TblToCompany
  */
 public function addCompanyRelationshipToPerson(TblCompany $tblCompany, TblPerson $tblPerson, TblType $tblType, $Remark)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblToCompany')->findOneBy(array(TblToCompany::SERVICE_TBL_COMPANY => $tblCompany->getId(), TblToCompany::SERVICE_TBL_PERSON => $tblPerson->getId(), TblToCompany::ATT_TBL_TYPE => $tblType->getId()));
     if (null === $Entity) {
         $Entity = new TblToCompany();
         $Entity->setServiceTblCompany($tblCompany);
         $Entity->setServiceTblPerson($tblPerson);
         $Entity->setTblType($tblType);
         $Entity->setRemark($Remark);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }