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:
commit
77a47d362c
@ -194,7 +194,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasParent() && null === $this->getParent()->getConfig()->getDataClass()) {
|
if ($this->parent && null === $this->parent->getConfig()->getDataClass()) {
|
||||||
return new PropertyPath('[' . $this->getName() . ']');
|
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()
|
public function hasParent()
|
||||||
{
|
{
|
||||||
@ -291,7 +296,7 @@ class Form implements \IteratorAggregate, FormInterface
|
|||||||
*/
|
*/
|
||||||
public function isRoot()
|
public function isRoot()
|
||||||
{
|
{
|
||||||
return !$this->hasParent();
|
return null === $this->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,13 +38,6 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable
|
|||||||
*/
|
*/
|
||||||
public function getParent();
|
public function getParent();
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the form has a parent.
|
|
||||||
*
|
|
||||||
* @return Boolean
|
|
||||||
*/
|
|
||||||
public function hasParent();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a child to the form.
|
* Adds a child to the form.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user