Reputation: 7159
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?
Upvotes: 2
Views: 1834
Reputation: 166
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 */
php pimcore/cli/console.php deployment:classes-rebuild
OPTION: Use same database username on your local env 'prod-user', which is useful if you will import prod database a lot
OPTION: replace DEFINER=prod-user
@%
with DEFINER=local-user
@%
before importing database
Upvotes: 1
Reputation: 7159
The error is happen when there are already objects present using the class.
Solution
Settings > Object > Classes
Now try to load the frondend. It will work.
Upvotes: 3
Reputation: 176
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.
Upvotes: 0
Reputation: 1030
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.
Upvotes: 0