File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
src/CoreBundle/DataFixtures Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1510,7 +1510,16 @@ function finishInstallationWithContainer(
15101510 /** @var User $admin */
15111511 $ admin = $ repo ->findOneBy (['username ' => 'admin ' ]);
15121512
1513- $ accessUrl = Container::getAccessUrlUtil ()->getCurrent ();
1513+ $ em = Container::getEntityManager ();
1514+ $ accessUrlRepo = $ em ->getRepository (AccessUrl::class);
1515+
1516+ $ accessUrl = $ accessUrlRepo ->findOneBy ([]);
1517+
1518+ if (!$ accessUrl ) {
1519+ $ accessUrl = Container::getAccessUrlUtil ()->getCurrent ();
1520+ $ em ->persist ($ accessUrl );
1521+ $ em ->flush ();
1522+ }
15141523
15151524 $ admin
15161525 ->setLastname ($ adminLastName )
Original file line number Diff line number Diff line change 66
77namespace Chamilo \CoreBundle \DataFixtures ;
88
9+ use Chamilo \CoreBundle \Entity \AccessUrl ;
910use Chamilo \CoreBundle \Entity \AccessUrlRelColorTheme ;
1011use Chamilo \CoreBundle \Entity \ColorTheme ;
1112use Chamilo \CoreBundle \Helpers \AccessUrlHelper ;
@@ -30,7 +31,6 @@ public function load(ObjectManager $manager): void
3031 ->findOneBy (['slug ' => 'chamilo ' ]);
3132
3233 if ($ existing ) {
33- echo "Chamilo color theme already exists. Skipping fixture. \n" ;
3434 return ;
3535 }
3636
@@ -66,6 +66,11 @@ public function load(ObjectManager $manager): void
6666
6767 $ accessUrl = $ this ->accessUrlHelper ->getCurrent ();
6868
69+ if (!$ accessUrl ->getId ()) {
70+ $ manager ->persist ($ accessUrl );
71+ $ manager ->flush ();
72+ }
73+
6974 $ accessUrlRel = (new AccessUrlRelColorTheme ())
7075 ->setUrl ($ accessUrl )
7176 ->setColorTheme ($ theme )
@@ -76,7 +81,5 @@ public function load(ObjectManager $manager): void
7681 $ manager ->persist ($ theme );
7782 $ manager ->persist ($ accessUrlRel );
7883 $ manager ->flush ();
79-
80- echo "Chamilo color theme fixture loaded successfully. \n" ;
8184 }
8285}
You can’t perform that action at this time.
0 commit comments