2

I am beginner in pimcore cms. When I open setting>objects>classes I couldn't see the list of classes in classes window. I checked error log and found the following error:

PHP Fatal error:  Uncaught Error: Call to a member function getId() on null in /var/www/html/pimcore/pimcore/modules/admin/controllers/ClassController.php:75
    Stack trace:
    #0 /var/www/html/pimcore/vendor/zendframework/zendframework1/library/Zend/Controller/Action.php(516): Admin_ClassController->getTreeAction()
    #1 /var/www/html/pimcore/vendor/zendframework/zendframework1/library/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('getTreeAction')

    #2 /var/www/html/pimcore/vendor/zendframework/zendframework1/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

    #3 /var/www/html/pimcore/pimcore/lib/Pimcore.php(159): Zend_Controller_Front->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))

    #4 /var/www/html/pimcore/pimcore/lib/Pimcore.php(125): Pimcore::runDispatcher(Object(Zend_Controller_Front), false, NULL, NULL)

    #5 /var/www/html/pimcore/index.php(23): Pimcore:: in /var/www/html/pimcore/pimcore/modules/admin/controllers/ClassController.php on line 75

 I couldn't find out what went wrong, also I'm absolute beginner in pimcore.
Ramesh
  • 57
  • 3
  • 10
  • Possible duplicate of [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – miken32 Nov 01 '18 at 20:45

1 Answers1

1

This happens when the classes in your file-system and database do not match. In you database you can see a table named classes.This table is keeping track of the class ids.In your file system there is id for each of your class files mentioned in the class file itself present in 'var/classes'. You can see the id in each of the file.

The problem you are facing is because these id's in file-system and database do not match. So pimcore could not find the class for specific id in the file-system which results in the error message 'Call to a member function getId() on null'.

The issue should be resolved with the following steps:

  1. Run 'bin/console' command at your project root.
  2. locate the command pimcore:rebuilt:classes
  3. Run this command with -d option
  4. Then run this command with -c option

You can open the help for the command using -h option

Pradeep
  • 19
  • 2