14
14
use Doctrine \ODM \PHPCR \DocumentManager ;
15
15
use Doctrine \ODM \PHPCR \Event \MoveEventArgs ;
16
16
use Doctrine \Common \Persistence \Event \LifecycleEventArgs ;
17
+ use Symfony \Cmf \Bundle \RoutingBundle \Model \Route as ModelRoute ;
17
18
18
19
/**
19
20
* Doctrine PHPCR-ODM listener to update the locale on routes based on the URL.
@@ -118,7 +119,7 @@ public function setUpdateAvailableTranslations($update)
118
119
public function postLoad (LifecycleEventArgs $ args )
119
120
{
120
121
$ doc = $ args ->getObject ();
121
- if (! $ doc instanceof Route ) {
122
+ if (! $ doc instanceof ModelRoute ) {
122
123
return ;
123
124
}
124
125
$ this ->updateLocale ($ doc , $ doc ->getId (), $ args ->getObjectManager ());
@@ -132,7 +133,7 @@ public function postLoad(LifecycleEventArgs $args)
132
133
public function postPersist (LifecycleEventArgs $ args )
133
134
{
134
135
$ doc = $ args ->getObject ();
135
- if (! $ doc instanceof Route ) {
136
+ if (! $ doc instanceof ModelRoute ) {
136
137
return ;
137
138
}
138
139
$ this ->updateLocale ($ doc , $ doc ->getId (), $ args ->getObjectManager ());
@@ -146,7 +147,7 @@ public function postPersist(LifecycleEventArgs $args)
146
147
public function postMove (MoveEventArgs $ args )
147
148
{
148
149
$ doc = $ args ->getObject ();
149
- if (! $ doc instanceof Route ) {
150
+ if (! $ doc instanceof ModelRoute ) {
150
151
return ;
151
152
}
152
153
$ this ->updateLocale ($ doc , $ args ->getTargetPath (), $ args ->getObjectManager (), true );
@@ -164,7 +165,7 @@ protected function getPrefixes()
164
165
* Update the locale of a route if $id starts with the prefix and has a
165
166
* valid locale right after.
166
167
*
167
- * @param Route $doc The route object
168
+ * @param ModelRoute $doc The route object
168
169
* @param string $id The id (in move case, this is not the current
169
170
* id of $route).
170
171
* @param DocumentManager $dm The document manager to get locales from if
@@ -173,7 +174,7 @@ protected function getPrefixes()
173
174
* @param boolean $force Whether to update the locale even if the
174
175
* route already has a locale.
175
176
*/
176
- protected function updateLocale (Route $ doc , $ id , DocumentManager $ dm , $ force = false )
177
+ protected function updateLocale (ModelRoute $ doc , $ id , DocumentManager $ dm , $ force = false )
177
178
{
178
179
$ matches = array ();
179
180
0 commit comments