當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FormInterface::getObject方法代碼示例

本文整理匯總了PHP中Zend\Form\FormInterface::getObject方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormInterface::getObject方法的具體用法?PHP FormInterface::getObject怎麽用?PHP FormInterface::getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Form\FormInterface的用法示例。


在下文中一共展示了FormInterface::getObject方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updatePost

 public function updatePost(FormInterface $form)
 {
     $post = $form->getObject();
     $this->assertGranted('blog.post.update', $post);
     $this->bind($post, $form);
     $this->objectManager->persist($post);
     $this->getEventManager()->trigger('update', $this, ['post' => $post]);
 }
開發者ID:andreas-serlo,項目名稱:athene2,代碼行數:8,代碼來源:BlogManager.php

示例2: fileCountValidationCallback

 /**
  * Callback for file count validation.
  *
  * @internal
  *      This function gets the value passed in as variable,
  *      but we do not need it.
  * @return bool
  */
 public function fileCountValidationCallback()
 {
     if ($this->form && ($object = $this->form->getObject())) {
         if ($this->getMaxFileCount() - 1 < count($object)) {
             return false;
         }
     }
     return true;
 }
開發者ID:webpants,項目名稱:YAWIK,代碼行數:17,代碼來源:FileUpload.php

示例3: editPageRepository

 public function editPageRepository(FormInterface $form)
 {
     $page = $form->getObject();
     if (!$form->isValid()) {
         throw new RuntimeException(print_r($form->getMessages(), true));
     }
     $data = $form->getData(FormInterface::VALUES_AS_ARRAY);
     $formClone = clone $form;
     $formClone->bind($page);
     $formClone->setData($data);
     $formClone->isValid();
     $this->assertGranted('page.update', $page);
     $this->getObjectManager()->persist($page);
     return $page;
 }
開發者ID:andreas-serlo,項目名稱:athene2,代碼行數:15,代碼來源:PageManager.php

示例4: updateParameter

 /**
  * @param FormInterface $form
  * @return void
  * @throws RuntimeException
  */
 public function updateParameter(FormInterface $form)
 {
     $object = $form->getObject();
     $this->assertGranted('navigation.manage', $object);
     if (!$form->isValid()) {
         throw new RuntimeException(print_r($form->getMessages()));
     }
     $this->objectManager->persist($object);
     $this->getEventManager()->trigger('parameter.update', $this);
 }
開發者ID:andreas-serlo,項目名稱:athene2,代碼行數:15,代碼來源:NavigationManager.php

示例5: openTag

 /**
  * {@inheritDoc}
  */
 public function openTag(FormInterface $form = null)
 {
     if ($form) {
         $class = $form->getAttribute('class');
         if (strpos($class, $this->defaultClass) === false) {
             $class = trim("{$class} {$this->defaultClass}");
         }
         if ($object = $form->getObject()) {
             $className = str_replace(array_keys($this->classNameReplacements), array_values($this->classNameReplacements), get_class($object));
         } else {
             $className = get_class($form);
         }
         $parts = explode('\\', $className);
         foreach ($parts as $part) {
             $classes[] = strtolower($part);
             if (count($classes) > 1) {
                 $class .= ' ' . implode('-', $classes);
             }
         }
         $form->setAttribute('class', $class);
         $formAttributes = $form->getAttributes();
         if (!array_key_exists('id', $formAttributes) && $classes) {
             $form->setAttribute('id', implode('-', $classes));
         }
     }
     return parent::openTag($form);
 }
開發者ID:coolms,項目名稱:common,代碼行數:30,代碼來源:Form.php


注:本文中的Zend\Form\FormInterface::getObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。