File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /*
3
+ * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
4
+ *
5
+ * Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Affero General Public License as published
9
+ * by the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Affero General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Affero General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+
21
+ declare (strict_types=1 );
22
+
23
+ /**
24
+ * This class extends the default doctrine ORM configuration to enable native lazy objects on PHP 8.4+.
25
+ * We have to do this in a PHP file, because the yaml file does not support conditionals on PHP version.
26
+ */
27
+
28
+ return static function (\Symfony \Config \DoctrineConfig $ doctrine ) {
29
+ //On PHP 8.4+ we can use native lazy objects, which are much more efficient than proxies.
30
+ if (PHP_VERSION_ID >= 80400 ) {
31
+ $ doctrine ->orm ()->enableNativeLazyObjects (true );
32
+ }
33
+ };
You can’t perform that action at this time.
0 commit comments