File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 14
14
15
15
use Doctrine \Common \Collections \Collection ;
16
16
use Doctrine \ODM \PHPCR \Document \Generic ;
17
+ use Doctrine \ODM \PHPCR \Exception \InvalidArgumentException ;
17
18
use Symfony \Cmf \Component \Routing \RouteObjectInterface ;
18
19
use Symfony \Cmf \Bundle \RoutingBundle \Model \Route as RouteModel ;
19
20
@@ -96,6 +97,10 @@ public function setAddTrailingSlash($addTrailingSlash)
96
97
*/
97
98
public function setParent ($ parent )
98
99
{
100
+ if (!is_object ($ parent )) {
101
+ throw new InvalidArgumentException ("Parent must be an object " .gettype ($ parent )." given. " );
102
+ }
103
+
99
104
$ this ->parent = $ parent ;
100
105
101
106
return $ this ;
@@ -138,6 +143,10 @@ public function getName()
138
143
*/
139
144
public function setPosition ($ parent , $ name )
140
145
{
146
+ if (!is_object ($ parent )) {
147
+ throw new InvalidArgumentException ("Parent must be an object " .gettype ($ parent )." given. " );
148
+ }
149
+
141
150
$ this ->parent = $ parent ;
142
151
$ this ->name = $ name ;
143
152
You can’t perform that action at this time.
0 commit comments