php - Doctrine generating wrong INSERT statement -


i generated mysql database using doctrine symfony , had modify 1 table, extracting 2 of attributes , assign them new entity. first entity called "area" , second 1 called "formato". previously, when wanted create new area, provided id, name, width , height. (as application designed in spanish, width called "ancho" , height called "alto") now, new design, idea provide id, name, , formatid. of course, there formats inserted in format table, , area have formatid foreign key formato. far it's not complex thing do, however, when try create new area, receive error:

abstractmysqldriver->convertexception('an exception occurred while executing \'insert areas (descripcion, nombre, idarea, ancho, alto, idmedio, idformato) values (?, ?, ?, ?, ?, ?, ?)\' params ["", "zilosoft area7", "21626759324", null, null, "28545628", "1"]:sqlstate[42s22]: column not found: 1054 unknown column \'ancho\' in \'field list\'', object(pdoexception)) 

so, can see, new insert statement mixing old attributes new one, generating sort of "mixed" or "merged" statement.

i've been searching on , on through source files can't understand how happening, entities date, meaning area has format , not "ancho" nor "alto", , formato separated entity "ancho" , "alto" inside it.

do know if should "reset" or "clean cache" in doctrine generates correct insert statement?

by way, formato data taken combo box in twig template, , loaded formatos table.

you're missing final step

so updated entities improve, update, or modify data structure, mysql database still has no idea made changes. way remedy telling doctrine update schema. way running following command on machine:

php bin/console doctrine:schema:update --force 

note --force try running query directly. if rather run queries yourself, can use --dump-sql option, print out queries


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -