Symfony2 Uncaught exception ReflectionException with message Class int/integer does not exist

使用symfony开发时产品环境的首页突然无法打开了,但是开发环境的却没问题,去看错误日志,发现报异常“Uncaught exception 'ReflectionException' with message 'Class int does not exist'”,百思不得其解,后来在网上看到有人认为entity问题报的是Class integer does not exist,有人是这样回复的:


You can't type hint on a scalar type (integer/string/boolean etc) in PHP. e.g.

public function setSortOrder(integer $sortOrder)

Should be:

public function setSortOrder($sortOrder)

You can validate the type of the value within the method and perhaps throw an InvalidArgumentException if passed something that isn't an integer.


于是想到会不会也是entity的问题,全站搜索果然发现有个entity里面是这样写的:

public function setCount(int $count)

把set/get函数删除,重新生成entity,大功告成,也可以直接进行修改:

public function setCount($count)



by 雪洁 2015-02-09 07:50:36 3215 views
我来说几句

相关文章