1
我遇到了PHP的Hateoas庫問題。Hateoas PHP庫中的註釋問題
我有一個主義實體,我想排除註釋添加到相關注釋如圖中documentation一個例子,如果我這樣做,我得到以下錯誤:
[Semantical Error] Annotation @Hateoas\Exclusion is not allowed to be declared on class My\Entity\Order. You may only use this annotation on these code elements: ANNOTATION
有誰知道如何解決這個問題?還是它是一個錯誤或不好的文檔?
實體:
<?php
namespace My\Entity;
use Doctrine\ORM\Mapping as ORM;
use Hateoas\Configuration\Annotation as Hateoas;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Entity
* @ORM\Table(name="`order`")
* @ORM\HasLifecycleCallbacks
*
* @Hateoas\Relation(
* "self",
* href = "expr('/order/' ~ object.getId())"),
* exclusion = @Hateoas\Exclusion(
* groups = {"production"}
* )
*)
* @Hateoas\Relation(
* "self",
* href = "expr('/production/' ~ object.getId())"),
* exclusion = @Hateoas\Exclusion(
* groups = {"order"}
* )
*)
*/
class Order
{
}
它是否解決您的問題? –
是的,它確實是我的問題 – tom