File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 13
13
14
14
use Doctrine \Common \Persistence \ManagerRegistry ;
15
15
use Doctrine \Common \Persistence \ObjectRepository ;
16
+ use Doctrine \DBAL \Exception \TableNotFoundException ;
16
17
use Symfony \Cmf \Component \Routing \Candidates \CandidatesInterface ;
17
18
use Symfony \Component \Routing \RouteCollection ;
18
19
use Symfony \Component \Routing \Exception \RouteNotFoundException ;
@@ -89,7 +90,11 @@ public function getRoutesByNames($names = null)
89
90
return array ();
90
91
}
91
92
92
- return $ this ->getRouteRepository ()->findBy (array (), null , $ this ->routeCollectionLimit ?: null );
93
+ try {
94
+ return $ this ->getRouteRepository ()->findBy (array (), null , $ this ->routeCollectionLimit ?: null );
95
+ } catch (TableNotFoundException $ e ) {
96
+ return array ();
97
+ }
93
98
}
94
99
95
100
$ routes = array ();
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Cmf \Bundle \RoutingBundle \Doctrine \Phpcr ;
13
13
14
+ use Doctrine \DBAL \Exception \TableNotFoundException ;
14
15
use PHPCR \RepositoryException ;
15
16
use PHPCR \Util \UUIDHelper ;
16
17
use Doctrine \Common \Persistence \ManagerRegistry ;
@@ -156,8 +157,17 @@ private function getAllRoutes()
156
157
return array ();
157
158
}
158
159
159
- /** @var $dm DocumentManager */
160
- $ dm = $ this ->getObjectManager ();
160
+ try {
161
+ /** @var $dm DocumentManager */
162
+ $ dm = $ this ->getObjectManager ();
163
+ } catch (RepositoryException $ e ) {
164
+ // special case: there is not even a database existing. this means there are no routes.
165
+ if ($ e ->getPrevious () instanceof TableNotFoundException) {
166
+ return array ();
167
+ }
168
+
169
+ throw $ e ;
170
+ }
161
171
$ qb = $ dm ->createQueryBuilder ();
162
172
163
173
$ qb ->from ('d ' )->document ('Symfony\Component\Routing\Route ' , 'd ' );
You can’t perform that action at this time.
0 commit comments