Пример #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;
 }
Пример #2
0
 /**
  * @param null|TblAccountKey $tblAccountKey
  */
 public function setTblAccountKey(TblAccountKey $tblAccountKey = null)
 {
     $this->tblAccountKey = null === $tblAccountKey ? null : $tblAccountKey->getId();
 }