示例#1
0
 /**
  * @param                   $ValidFrom
  * @param                   $Value
  * @param                   $ValidTo
  * @param                   $Description
  * @param                   $Code
  * @param TblAccountKeyType $tblAccountKeyType
  *
  * @return TblAccountKey|null|object
  */
 public function actionCreateKey($ValidFrom, $Value, $ValidTo, $Description, $Code, TblAccountKeyType $tblAccountKeyType)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblAccountKey')->findOneBy(array('ValidFrom' => new \DateTime($ValidFrom), 'Value' => $Value, 'ValidTo' => new \DateTime($ValidTo), 'Description' => $Description, 'Code' => $Code, 'tblAccountKeyType' => $tblAccountKeyType->getId()));
     if (null === $Entity) {
         $Entity = new TblAccountKey();
         $Entity->setValidFrom(new \DateTime($ValidFrom));
         $Entity->setValue($Value);
         $Entity->setValidTo(new \DateTime($ValidTo));
         $Entity->setDescription($Description);
         $Entity->setCode($Code);
         $Entity->setTableAccountKeyType($tblAccountKeyType);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }
 /**
  * @param bool|TblAccountKeyType $tblAccountKeyType
  */
 public function setTableAccountKeyType(TblAccountKeyType $tblAccountKeyType = null)
 {
     $this->tblAccountKeyType = null === $tblAccountKeyType ? null : $tblAccountKeyType->getId();
 }