Example #1
0
 /**
  * @param TblCompany $tblCompany
  * @param TblAddress $tblAddress
  * @param TblType    $tblType
  * @param string     $Remark
  *
  * @return TblToCompany
  */
 public function addAddressToCompany(TblCompany $tblCompany, TblAddress $tblAddress, TblType $tblType, $Remark)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblToCompany')->findOneBy(array(TblToCompany::SERVICE_TBL_COMPANY => $tblCompany->getId(), TblToCompany::ATT_TBL_ADDRESS => $tblAddress->getId(), TblToCompany::ATT_TBL_TYPE => $tblType->getId()));
     if (null === $Entity) {
         $Entity = new TblToCompany();
         $Entity->setServiceTblCompany($tblCompany);
         $Entity->setTblAddress($tblAddress);
         $Entity->setTblType($tblType);
         $Entity->setRemark($Remark);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }
 /**
  * @param null|TblType $tblType
  */
 public function setTblType(TblType $tblType = null)
 {
     $this->tblType = null === $tblType ? null : $tblType->getId();
 }