Ejemplo n.º 1
0
 /**
  * @param string $Name
  * @param string $Description
  * @param bool   $IsLocked
  *
  * @return TblType
  */
 public function createType($Name, $Description = '', $IsLocked = false)
 {
     $Manager = $this->Connection->getEntityManager();
     if ($IsLocked) {
         $Entity = $Manager->getEntity('TblType')->findOneBy(array(TblType::ATTR_NAME => $Name, TblType::ATTR_IS_LOCKED => $IsLocked));
     } else {
         $Entity = $Manager->getEntity('TblType')->findOneBy(array(TblType::ATTR_NAME => $Name));
     }
     if (null === $Entity) {
         $Entity = new TblType();
         $Entity->setName($Name);
         $Entity->setDescription($Description);
         $Entity->setIsLocked($IsLocked);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }
Ejemplo n.º 2
0
 /**
  * @param null|TblType $tblType
  */
 public function setTblType(TblType $tblType = null)
 {
     $this->tblType = null === $tblType ? null : $tblType->getId();
 }
Ejemplo n.º 3
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 = $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;
 }