/**
  * @param null|TblState $tblState
  */
 public function setTblState(TblState $tblState = null)
 {
     $this->tblState = null === $tblState ? null : $tblState->getId();
 }
Example #2
0
 /**
  * @param TblState $tblState
  * @param TblCity  $tblCity
  * @param string   $StreetName
  * @param string   $StreetNumber
  * @param string   $PostOfficeBox
  *
  * @return TblAddress
  */
 public function createAddress(TblState $tblState, TblCity $tblCity, $StreetName, $StreetNumber, $PostOfficeBox)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblAddress')->findOneBy(array(TblAddress::ATTR_TBL_STATE => $tblState->getId(), TblAddress::ATTR_TBL_CITY => $tblCity->getId(), TblAddress::ATTR_STREET_NAME => $StreetName, TblAddress::ATTR_STREET_NUMBER => $StreetNumber, TblAddress::ATTR_POST_OFFICE_BOX => $PostOfficeBox));
     if (null === $Entity) {
         $Entity = new TblAddress();
         $Entity->setStreetName($StreetName);
         $Entity->setStreetNumber($StreetNumber);
         $Entity->setPostOfficeBox($PostOfficeBox);
         $Entity->setTblState($tblState);
         $Entity->setTblCity($tblCity);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }