当前位置: 首页>>代码示例>>PHP>>正文


PHP FormInterface::setParent方法代码示例

本文整理汇总了PHP中Symfony\Component\Form\FormInterface::setParent方法的典型用法代码示例。如果您正苦于以下问题:PHP FormInterface::setParent方法的具体用法?PHP FormInterface::setParent怎么用?PHP FormInterface::setParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Form\FormInterface的用法示例。


在下文中一共展示了FormInterface::setParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

    /**
     * Adds a child to the form.
     *
     * @param FormInterface $child The FormInterface to add as a child
     *
     * @return Form the current form
     */
    public function add(FormInterface $child)
    {
        $this->children[$child->getName()] = $child;

        $child->setParent($this);

        if ($this->dataMapper) {
            $this->dataMapper->mapDataToForm($this->getClientData(), $child);
        }

        return $this;
    }
开发者ID:noloman,项目名称:mtproject,代码行数:19,代码来源:Form.php

示例2: add

 /**
  * {@inheritdoc}
  */
 public function add(FormInterface $child)
 {
     if ($this->bound) {
         throw new AlreadyBoundException('You cannot add children to a bound form');
     }
     if (!$this->config->getCompound()) {
         throw new FormException('You cannot add children to a simple form. Maybe you should set the option "compound" to true?');
     }
     // Obtain the view data
     $viewData = null;
     // If setData() is currently being called, there is no need to call
     // mapDataToForms() here, as mapDataToForms() is called at the end
     // of setData() anyway. Not doing this check leads to an endless
     // recursion when initializing the form lazily and an event listener
     // (such as ResizeFormListener) adds fields depending on the data:
     //
     //  * setData() is called, the form is not initialized yet
     //  * add() is called by the listener (setData() is not complete, so
     //    the form is still not initialized)
     //  * getViewData() is called
     //  * setData() is called since the form is not initialized yet
     //  * ... endless recursion ...
     if (!$this->lockSetData) {
         $viewData = $this->getViewData();
     }
     $this->children[$child->getName()] = $child;
     $child->setParent($this);
     if (!$this->lockSetData) {
         $this->config->getDataMapper()->mapDataToForms($viewData, array($child));
     }
     return $this;
 }
开发者ID:netvlies,项目名称:symfony,代码行数:35,代码来源:Form.php

示例3: add

 /**
  * {@inheritdoc}
  */
 public function add(FormInterface $child)
 {
     if ($this->bound) {
         throw new AlreadyBoundException('You cannot add children to a bound form');
     }
     $this->children[$child->getName()] = $child;
     $child->setParent($this);
     if ($this->config->getDataMapper()) {
         $this->config->getDataMapper()->mapDataToForms($this->getViewData(), array($child));
     }
     return $this;
 }
开发者ID:laubosslink,项目名称:lab,代码行数:15,代码来源:Form.php

示例4: add

 /**
  * Adds a child to the form.
  *
  * @param FormInterface $child The FormInterface to add as a child
  *
  * @return Form the current form
  */
 public function add(FormInterface $child)
 {
     if ($this->bound) {
         throw new AlreadyBoundException('You cannot add children to a bound form');
     }
     $this->children[$child->getName()] = $child;
     $child->setParent($this);
     if ($this->dataMapper) {
         $this->dataMapper->mapDataToForm($this->getClientData(), $child);
     }
     return $this;
 }
开发者ID:nicodmf,项目名称:symfony,代码行数:19,代码来源:Form.php


注:本文中的Symfony\Component\Form\FormInterface::setParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。