Beispiel #1
0
 /**
  * @param TblCompany $tblCompany
  * @param TblType    $tblType
  *
  * @return TblSchool|bool
  */
 public function addSchool(TblCompany $tblCompany, TblType $tblType)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblSchool')->findOneBy(array(TblSchool::SERVICE_TBL_COMPANY => $tblCompany->getId(), TblSchool::ATT_TBL_TYPE => $tblType->getId()));
     if (null === $Entity) {
         $Entity = new TblSchool();
         $Entity->setServiceTblCompany($tblCompany);
         $Entity->setTblType($tblType);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
         return $Entity;
     }
     return false;
 }
 /**
  * @param null|TblType $tblType
  */
 public function setTblType(TblType $tblType = null)
 {
     $this->tblType = null === $tblType ? null : $tblType->getId();
 }