From 634adc93298c4251495d2617d1c18009e5ce497b Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sun, 26 Oct 2025 10:08:30 +0100 Subject: [PATCH] :bug: Throw if we cannot lazy load Previously we were giving the false impression that it was possible to lazy-load the bean. But we would effectively load it. --- ...TDBMCannotLazyLoadInheritanceException.php | 19 +++++++++++++++++++ src/TDBMService.php | 2 ++ tests/TDBMDaoGeneratorTest.php | 8 ++++++++ 3 files changed, 29 insertions(+) create mode 100644 src/TDBMCannotLazyLoadInheritanceException.php diff --git a/src/TDBMCannotLazyLoadInheritanceException.php b/src/TDBMCannotLazyLoadInheritanceException.php new file mode 100644 index 00000000..284c59ec --- /dev/null +++ b/src/TDBMCannotLazyLoadInheritanceException.php @@ -0,0 +1,19 @@ +assertSame(TDBMObjectStateEnum::STATE_LOADED, $country->_getStatus()); // This is failing } + public function testGetByIdLazyLoadFailsOnInheritance(): void + { + $this->expectException(TDBMCannotLazyLoadInheritanceException::class); + $this->expectExceptionMessage('Failed to lazy load the tables (person, contact, users) as they are part of inheritance.'); + $userDao = new UserDao($this->tdbmService); + $userDao->getById(1, true); + } + private function skipOracle(): void { if (self::getConnection()->getDatabasePlatform() instanceof OraclePlatform) {