8000 merged branch Tobion/formhasparent (PR #5360) · symfony/symfony@77a47d3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 77a47d3

Browse files
committed
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 :+1:
2 parents 0e9156d + 0186731 commit 77a47d3

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/Symfony/Component/Form/Form.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function getPropertyPath()
194194
return null;
195195
}
196196

197-
if ($this->hasParent() && null === $this->getParent()->getConfig()->getDataClass()) {
197+
if ($this->parent && null === $this->parent->getConfig()->getDataClass()) {
198198
return new PropertyPath('[' . $this->getName() . ']');
199199
}
200200

@@ -271,7 +271,12 @@ public function getParent()
271271
}
272272

273273
/**
274-
* {@inheritdoc}
274+
* Returns whether the form has a parent.
275+
*
276+
* @return Boolean
277+
*
278+
* @deprecated Deprecated since version 2.1, to be removed in 2.3. Use
279+
* {@link getParent()} or inverse {@link isRoot()} instead.
275280
*/
276281
public function hasParent()
277282
{
@@ -291,7 +296,7 @@ public function getRoot()
291296
*/
292297
public function isRoot()
293298
{
294-
return !$this->hasParent();
299+
return null === $this->parent;
295300
}
296301

297302
/**

src/Symfony/Component/Form/FormInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ public function setParent(FormInterface $parent = null);
3838
*/
3939
public function getParent();
4040

41-
/**
42-
* Returns whether the form has a parent.
43-
*
44-
* @return Boolean
45-
*/
46-
public function hasParent();
47-
4841
/**
4942
* Adds a child to the form.
5043
*

0 commit comments

Comments
 (0)
0