コード例 #1
0
 /**
  *
  * @param IXP_Form_Contact $form The form object
  * @param \Entities\Contact $object The Doctrine2 entity (being edited or blank for add)
  * @param bool $isEdit True of we are editing an object, false otherwise
  * @return void
  */
 protected function addPostValidate($form, $object, $isEdit)
 {
     $object->setCustomer($this->getD2EM()->getRepository('\\Entities\\Customer')->find($form->getElement('custid')->getValue()));
     $object->setCabinet($this->getD2EM()->getRepository('\\Entities\\Cabinet')->find($form->getElement('cabinetid')->getValue()));
     return true;
 }
コード例 #2
0
 /**
  *
  * @param IXP_Form_Contact $form The form object
  * @param \Entities\Contact $object The Doctrine2 entity (being edited or blank for add)
  * @param bool $isEdit True of we are editing an object, false otherwise
  * @return bool If false, the form is not processed
  */
 protected function addPostValidate($form, $object, $isEdit)
 {
     if ($this->getUser()->getPrivs() == \Entities\User::AUTH_SUPERUSER) {
         $object->setCustomer($this->getD2R('\\Entities\\Customer')->find($form->getElement('custid')->getValue()));
     } else {
         $object->setCustomer($this->getUser()->getCustomer());
     }
     if (!$isEdit) {
         $object->setCreated(new DateTime());
         $object->setCreator($this->getUser()->getUsername());
     }
     $object->setLastupdated(new DateTime());
     $object->setLastupdatedby($this->getUser()->getId());
     if (!$this->_processUser($form, $object, $isEdit)) {
         return false;
     }
     // let the group processor have the final say as to whether post validation
     // passes or not
     return $this->_setContactGroups($form, $object);
 }