Doctrine Column not found: 1054 Unknown column 's.features' in 'field list''
Asked Answered
C

2

8

I added a new column "features" to the site table and regenerated the models using Doctrine.
This code is causing an error:

 $siteTable = Doctrine_Core::getTable("Site");
 $site = $siteTable->findOneByName("site"); // this line is throwing an exception

Exception:

Unknown column "s.features" in field list.....

I checked the database and it contains the field, I also checked the Site model and the table definition contains the column information. The primary key of all tables is id. Also in the line which throws the exception I am not using the newly added column. If I remove the column from the table definition of the site object then the above code works...

This error is happening to any table when I add a new column and regenerate the models from it.

Cochise answered 16/7, 2010 at 5:43 Comment(4)
Have you checked the database has the column? Sounds like you haven't rebuilt the database.Airlia
Could your post your model (schema.yml for instance) and your SQL DB schema?Susannahsusanne
If you really want to get this answered please post. The output of DESCRIBE site; from database. Your schema.yml file. And the BaseSite comment block from the top of your generated/BaseSite.php fileCovington
I haven't used Doctrine with Zend Framework, but what can sometimes happen with Symfony is that doctrine generates two versions of your model files (in my experience this is often the result of rebuilding your database on different computers when one has APC installed and the other doesn't) PHP on the command line usually uses a different php.ini file to Apache so the Model files generated on the command line aren't always the same ones that are autoloaded by Doctrine in your website. Anyway, that is a possible cause of the problem.Farnese
S
1

Do you checked the generated Base Table Classes ? Should be BaseSite.class.php

./doctrine build-all

should fix the Problem.

Serval answered 10/10, 2011 at 16:20 Comment(0)
G
0

check this command out
goto doctrine directory
there must be bin/ and Doctrine/ directories there

php bin/doctrine orm:generate-proxies
Gully answered 31/8, 2012 at 10:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.