API won't stop eager loading

泄露秘密 提交于 2019-12-11 02:12:19

问题


I'm reading the docs here: https://api-platform.com/docs/core/performance/#eager-loading

No matter what config I try, my API always eager loads relations in my payload. Why is the API Platform ignoring these settings?

I've tried this to no avail

# api/config/packages/api_platform.yaml
api_platform:
    eager_loading:
        force_eager: false

# also tried this
api_platform:
    eager_loading:
        enabled: false

I've also tried annotations on my entity & relationship

/**
 * @ApiResource(attributes={"force_eager"=false})
 * @ORM\Entity
 */
class User
{
  /**
     * @var Address
     *
     * @ORM\ManyToOne(targetEntity="Address", fetch="LAZY")
     */
    public $address;```



来源:https://stackoverflow.com/questions/55985251/api-wont-stop-eager-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!