[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.
This commit is contained in:
Tobias Schultze 2012-08-26 20:17:24 +02:00
parent c0590bfd7c
commit 0186731cca
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.
*