/** * @param TblCompany $tblCompany * @param TblMail $tblMail * @param TblType $tblType * @param string $Remark * * @return TblToCompany */ public function addMailToCompany(TblCompany $tblCompany, TblMail $tblMail, TblType $tblType, $Remark) { $Manager = $this->Connection->getEntityManager(); $Entity = $Manager->getEntity('TblToCompany')->findOneBy(array(TblToCompany::SERVICE_TBL_COMPANY => $tblCompany->getId(), TblToCompany::ATT_TBL_MAIL => $tblMail->getId(), TblToCompany::ATT_TBL_TYPE => $tblType->getId())); if (null === $Entity) { $Entity = new TblToCompany(); $Entity->setServiceTblCompany($tblCompany); $Entity->setTblMail($tblMail); $Entity->setTblType($tblType); $Entity->setRemark($Remark); $Manager->saveEntity($Entity); Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity); } return $Entity; }
/** * @param null|TblMail $tblMail */ public function setTblMail(TblMail $tblMail = null) { $this->tblMail = null === $tblMail ? null : $tblMail->getId(); }