0

I want to use use Day, Week, Month and Year functions of DoctrineExtensions in ZF2 and am getting the below error message. The code works fine on my local machine running on Windows but the same code does not work on server running on Linux.

Fatal error: Uncaught Error: Class 'DoctrineExtensions\Query\Mysql\Day' not found

Here is my module.config.php configuration

'configuration' => array(
        'orm_default' => array(
            'datetime_functions' => array(
                'day' => 'DoctrineExtensions\Query\MySql\Day',
                'week' => 'DoctrineExtensions\Query\MySql\Week',
                'month' => 'DoctrineExtensions\Query\MySql\Month',
                'Year' => 'DoctrineExtensions\Query\MySql\Year',
            ),
            'string_functions'   => array(),
        )
    ),

I installed the module using composer.

Chibuike Mba
  • 327
  • 1
  • 10
  • I recommend using Class name resolution via ::class (http://php.net/manual/en/migration55.new-features.php#migration55.new-features.class-name), to reduce the amount of "magic" strings in your code and as a bonus, your IDE (if you use one) will hint if the class exists or not. `\DoctrineExtensions\Query\MySql\Day::class` instead of `'DoctrineExtensions\Query\MySql\Day'`. – Dymen1 May 23 '17 at 19:48
  • Could you check in the vendor folder of your server, if the file containing the class exists? `find . -name "DoctrineExtensions*"` should tell you if it's the dependency is there. – Dymen1 May 23 '17 at 19:52

1 Answers1

0

"DoctrineExtensions\Query\MySql\" should be "DoctrineExtensions\Query\Mysql\" with small "s" not Capital "S". Linux are case sensitive that is why it cannot find the path of the classes. I have the same problem and this is how we solved it. Hope this helps.