Closed jonathaningram closed 13 years ago
Have you tried the same code on any other version of php or other operating system? Does it work on any other circumstances/environment?
Apparently php does not find the Dao_Db_CompanyDao class. I assume (because of our last talks) that ZF should be autoloading that class, or any autoloader of your own, and this is not happening (from what I can see in the error posted).
Can you confirm is an autoloading issue or maybe show me some example code?
I just confirmed that the code works with PHP 5.3.5 (and the same revision of Reflection) on Windows as well as PHP 5.3.1 - this leads me to believe that during the deployment to my linux box, either the file owner/group/permissions are wrong resulting in Reflection not being able to read the file. When it comes to autoloading I'm not really that good at debugging it - do you have some suggestions to determine if its not possible to autoload this class?
OK I have solved the problem - for anyone that ever reads this or comes across this via a Google Search for Zend Framework cannot find class, read this: in Zend Framework, no matter what OS you are using, name your folders in the same case as the name of the class! If you have a class Dao_Db_X, then put it in the folder Daos/Db/X.php and when setting up a resource autoloader, make sure that you specify the folder name as 'Daos', not 'daos'! Then when you eventually deploy to Linux, it will work.
Sorry about this Marcelo - not really related to Ding was it :)
Hey jon, good to hear that ;) Thank you for the complete solution. I'll set this as invalid then. pheww ;)
When I try and use my app on linux, with PHP 5.3.5, I have this exception:
Fatal error: Uncaught exception 'ReflectionException' with message 'Class Dao_Db_CompanyDao does not exist' in /opt/lampp/htdocs/billy_0.0.2/library/Ding/Reflection/ReflectionFactory.php:243 Stack trace:
0 /opt/lampp/htdocs/billy_0.0.2/library/Ding/Reflection/ReflectionFactory.php(243): ReflectionClass->__construct('Dao_Db_CompanyD...')
1 /opt/lampp/htdocs/billy_0.0.2/library/Ding/Container/Impl/ContainerImpl.php(336): Ding\Reflection\ReflectionFactory::getClass('Dao_Db_CompanyD...')
2 /opt/lampp/htdocs/billy_0.0.2/library/Ding/Container/Impl/ContainerImpl.php(430): Ding\Container\Impl\ContainerImpl->_createBean(Object(Ding\Bean\BeanDefinition))
3 /opt/lampp/htdocs/billy_0.0.2/library/Ding/Bean/Factory/Driver/DependsOnDriver.php(70): Ding\Container\Impl\ContainerImpl->getBean('companyDao')
4 /opt/lampp/htdocs/billy_0.0.2/library/Ding/Container/Impl/ContainerImpl.php(202): Ding\Bean\Factory\Driver\DependsOnDriver->afterDefinition(Object(Ding\Container\Impl\ContainerImpl), Object(Ding\Bean\BeanDefinition))
5 /opt/lamp in /opt/lampp/htdocs/billy_0.0.2/library/Ding/Reflection/ReflectionFactory.php on line 243
I am trying to confirm that it fails with v5.3.5 on Windows too, but what are your thoughts?