merged branch Tobion/formhasparent (PR #5360)

Commits
-------

0186731 [Form] removed hasParent from FormInterface and deprecated its use

Discussion
----------

[Form] removed hasParent from FormInterface and deprecated its use

There are already 2 alternatives with getParent() and isRoot(), so a third one with similar semantics is confusing and unneeded.

---------------------------------------------------------------------------

by bschussek at 2012-08-29T11:11:11Z

👍
This commit is contained in:
Fabien Potencier 2012-08-29 13:43:39 +02:00
commit 77a47d362c
2 changed files with 8 additions and 10 deletions

View File

@ -194,7 +194,7 @@ class Form implements \IteratorAggregate, FormInterface
return null;
}
if ($this->hasParent() && null === $this->getParent()->getConfig()->getDataClass()) {
if ($this->parent && null === $this->parent->getConfig()->getDataClass()) {
return new PropertyPath('[' . $this->getName() . ']');
}
@ -271,7 +271,12 @@ class Form implements \IteratorAggregate, FormInterface
}
/**
* {@inheritdoc}
* Returns whether the form has a parent.
*
* @return Boolean
*
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
* {@link getParent()} or inverse {@link isRoot()} instead.
*/
public function hasParent()
{
@ -291,7 +296,7 @@ class Form implements \IteratorAggregate, FormInterface
*/
public function isRoot()
{
return !$this->hasParent();
return null === $this->parent;
}
/**

View File

@ -38,13 +38,6 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
*/
public function getParent();
/**
* Returns whether the form has a parent.
*
* @return Boolean
*/
public function hasParent();
/**
* Adds a child to the form.
*