Reputation: 336
For last few days I'm experiencing following issue with doctrine - since I am not allowed to paste any source code, I'll try to describe briefly:
I am using doctrine orm and I need to add a new column to an existing table in DB - mapping between DB and entities is done via xml mapping file - here are the steps I've proceeded:
When I then run the application, I am still getting this error:
[Semantical Error] Error: Class Entity.php has no field or association named newColumn
So, if I am understanding this properly, it is saying that in the Entity.php is not field newColumn to which should be the new DB column mapped.
But that is not the case, since it was the very first step I've done.
I've already tried this:
Upvotes: 4
Views: 6797
Reputation: 937
run this command
php bin/console doctrine:cache:clear-metadata
on both APP_ENV=prod
and APP_ENV=dev
Upvotes: 2
Reputation: 11
Have the same problem. The solution was to replace in query condition like
LOWER(l.bank_title) LIKE :search
with its camelCase variant:
LOWER(l.bankTitle) LIKE :search
Upvotes: 1
Reputation: 41
Maybe my problem and solution would help somebody.
/* *
* @ORM\Column(name="user_id")
*/
protected $userId;
No, there was no typo in variable name. Access is correct and everything looked to be fine. Some of you probably already see the problem. Yes. It's /* * instead of /**. I took me about hour to find it :] What was strange - it was working in join, but not when I have used it in where.
Upvotes: 4
Reputation: 76
Check your metadata cache. If you're using some external caching mechanism (like Memcached or xcache) it's probably shared across your vhosts. If one vhost populates the cache with its own mapping metadata (after apache restart), second vhost just uses it and doesn't care about different .dcm.xml mappings.
If it's your development server/vhost, it's usually much better to disable ORM caching at all (config/autoload/database.local.php).
Upvotes: 6