我有这个控制器:
public function getLogAction()
{
$result = $this->getDoctrine()->getRepository(ChangeLog::class)->findAll();
if ($result === NULL) {
return new View("Log not found", Response::HTTP_NOT_FOUND);
}
return new View($result,Response::HTTP_OK);
}
和这个Entity.ChangeLog.yml:
AppBundle\Entity\ChangeLog:
exclusion_policy: ALL
properties:
id:
type: integer
date:
access_type: public_method
expose: true
type: datetime
user:
type: AppBundle\Entity\Category
access_type: public_method
expose: true
type: string
entityName:
expose: true
type: string
entityId:
type: int
expose: true
action:
type: string
expose: true
changeSet:
type: array
expose: true
description:
type: string
expose: true
当我尝试获取表格中的所有记录时,我收到此错误,但我无法理解元数据中的错误:
要定义的AppBundle \ Entity \ ChangeLog类的预期元数据 在 /vagrant/catalog/app/config/serializer/AppBundle/Entity.ChangeLog.yml
我想,我需要对change_set做些什么,但我不知道怎么做......也许你可以帮我... 的 UPDATE1
使用元数据(编辑)进行一些操作后,我收到此错误:
警告:ReflectionProperty :: getValue()期望参数1为 对象,给定的字符串
答案 0 :(得分:0)
我认为这个错误
Warning: ReflectionProperty::getValue() expects parameter 1 to be object, string given
是因为你有两种类型
user:
type: AppBundle\Entity\Category
access_type: public_method
expose: true
type: string