Skip to content

Commit baf6354

Browse files
committed
Merge pull request #313 from symfony-cmf/deprecation_internal
Trigger deprecation notices
2 parents 1d28e6a + 78c8a3f commit baf6354

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

Doctrine/Phpcr/RedirectRoute.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,19 @@ public function __construct(array $options = array())
7373
*/
7474
public function setParent($parent)
7575
{
76-
$this->parent = $parent;
76+
@trigger_error('The Route#setParent() method is deprecated as of version 1.2 and will be removed in 2.0. Use setParentDocument() instead.', E_USER_DEPRECATED);
7777

78-
return $this;
78+
return $this->setParentDocument($parent);
7979
}
8080

8181
/**
8282
* @deprecated Use getParentDocument instead.
8383
*/
8484
public function getParent()
8585
{
86-
return $this->parent;
86+
@trigger_error('The Route#getParent() method is deprecated as of version 1.2 and will be removed in 2.0. Use getParentDocument() instead.', E_USER_DEPRECATED);
87+
88+
return $this->getParentDocument();
8789
}
8890

8991
/**

Doctrine/Phpcr/Route.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,19 @@ public function setAddTrailingSlash($addTrailingSlash)
9393
*/
9494
public function setParent($parent)
9595
{
96-
$this->parent = $parent;
96+
@trigger_error('The Route#setParent() method is deprecated as of version 1.2 and will be removed in 2.0. Use setParentDocument() instead.', E_USER_DEPRECATED);
9797

98-
return $this;
98+
return $this->setParentDocument($parent);
9999
}
100100

101101
/**
102102
* @deprecated Use getParentDocument instead.
103103
*/
104104
public function getParent()
105105
{
106-
return $this->parent;
106+
@trigger_error('The Route#getParent() method is deprecated as of version 1.2 and will be removed in 2.0. Use getParentDocument() instead.', E_USER_DEPRECATED);
107+
108+
return $this->getParentDocument();
107109
}
108110

109111
/**
@@ -112,6 +114,8 @@ public function getParent()
112114
* Note that this will change the URL this route matches.
113115
*
114116
* @param object $parent the new parent document
117+
*
118+
* @return $this
115119
*/
116120
public function setParentDocument($parent)
117121
{

Tests/Functional/Doctrine/Phpcr/RouteProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private function buildRoutes()
4545

4646
// smuggle a non-route thing into the repository
4747
$noroute = new Generic;
48-
$noroute->setParent($route);
48+
$noroute->setParentDocument($route);
4949
$noroute->setNodename('noroute');
5050
$this->getDm()->persist($noroute);
5151

Tests/Resources/DataFixtures/Phpcr/LoadRouteData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function load(ObjectManager $manager)
2626

2727
$root = $manager->find(null, '/test');
2828
$parent = new Generic;
29-
$parent->setParent($root);
29+
$parent->setParentDocument($root);
3030
$parent->setNodename('routing');
3131
$manager->persist($parent);
3232

0 commit comments

Comments
 (0)