Mongodb-odm: PHP7 - Int annotation class is a reserved class name

Created on 20 Jul 2016  路  5Comments  路  Source: doctrine/mongodb-odm

FatalErrorException in
vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/Int.php:26

Compile Error: Cannot use 'Int' as class name as it is reserved

Question

Most helpful comment

Maybe, instead of @deprecated This class will be removed in ODM 2.0 you should put something like

@deprecated This class will be removed in ODM 2.0. Use `@ODM\Field(type="int")` instead

All 5 comments

Using ODM in PHP 7 you cannot use the Int, String, Float and Bool annotations for mapping. In fact, they aren't included for PHP 7. Instead, you have to use the Field mapping with the type property set:

/** @ODM\Field(type="int") */
var $intField

And its also in the docs - I was just to fast, sorry

No worries. Glad it's solved.

Maybe, instead of @deprecated This class will be removed in ODM 2.0 you should put something like

@deprecated This class will be removed in ODM 2.0. Use `@ODM\Field(type="int")` instead

@j0k3r good idea, mind adding the note? If not I can do it later in the evening

Was this page helpful?
0 / 5 - 0 ratings