2

I moved all my pimcore files plus the database from a server to my localhost and made the necessary changes in website/var/config/system.xml. Admin is working but the frond end is showing an error:

Fatal error: Call to a member function getFielddefinitions() on a non-object in /var/www/html/pimcore/pimcore/models/Object/Localizedfield/Resource.php on line 179

This line of code produces the error:

$this->model->getClass()->getFielddefinition("localizedfields")->getFielddefinitions()

The system requirements and file permissions are correct.

For testing purpose I installed a new pimcore project on my local system and it's working perfectly.

Can I make any changes in my Database? How can I run my project successfully on local?

Stephan Weinhold
  • 1,623
  • 1
  • 28
  • 37
Vinod VT
  • 6,946
  • 11
  • 51
  • 75

4 Answers4

3

The error is happen when there are already objects present using the class.

Solution

  1. Login to backend as Admin.
  2. Go to Settings > Object > Classes
  3. For each of the classes in the left tree, click on them and then hit Save in the bottom right. (If unable to save just create a new class by hit the button Add new class )

Now try to load the frondend. It will work.

Vinod VT
  • 6,946
  • 11
  • 51
  • 75
1

Pimcore uses database views for storing objects data. When exporting database, in views definitions there will be also SECURITY DEFINER.

/*!50013 DEFINER=`prod-user`@`%` SQL SECURITY DEFINER */

  1. OPTION: Vinot VT solution should work You can acchive same with running command:

php pimcore/cli/console.php deployment:classes-rebuild

  1. OPTION: Use same database username on your local env 'prod-user', which is useful if you will import prod database a lot

  2. OPTION: replace DEFINER=prod-user@% with DEFINER=local-user@% before importing database

fuzin
  • 166
  • 1
  • 4
0

You can:

  • set <debug>1</debug> in config.xml - this should show error

  • if it wasn't helped, check apache and/or php error log.

Rafal Gałka
  • 1,022
  • 1
  • 10
  • 16
0

We need to see the actual error (as Vinod has already pointed out).

I could speculate, though:

Are the database credentials (aka the DB username) identical? If not you might need to remove the SECURITY DEFINER from the DB Dump. See: Remove DEFINER clause from MySQL Dumps for hints on how to do that.

Another source of error might be the cache. Are you using the default file-based Pimcore cache? If this is the case, try removing all files from website/var/cache and website/var/tmp

Let us know how that turned out.

Community
  • 1
  • 1
chluehr
  • 166
  • 10