From 0186731cca02216d3ef35c45da17fc8b2a1345fb Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sun, 26 Aug 2012 20:17:24 +0200 Subject: [PATCH] [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. --- src/Symfony/Component/Form/Form.php | 11 ++++++++--- src/Symfony/Component/Form/FormInterface.php | 7 ------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 6fcc1cb6b0..baa5701b7d 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -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; } /** diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php index 31582205b3..8b307660ca 100644 --- a/src/Symfony/Component/Form/FormInterface.php +++ b/src/Symfony/Component/Form/FormInterface.php @@ -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. *