Last Updated: February 25, 2016
· gxela

Symfony 2.0 to 2.3 update, entity length and nullable properties

length property in Symfony 2.3 Entities is of type integer

run this:

php app/console cache:clear --env prod

get this error:


[Type Error] Attribute "length" of ... expects a(n) integer, but got string.


...(name="type", type="string", length="10")


...(name="type", type="string", length=10)

notice the lack of quotes around the length property value

Change all instances of this string-part in your code, length="X" to length=X

do the same thing for nullable property too, change:




to find all instances that need to be replaced and replace them manually, type:

egrep -Rn 'length="|nullable="' /path/to/symfony

don't worry about changing strings in vendor/, just make the changes in your application and the errors will go away.