-->

API won't stop eager loading

2019-07-15 02:44发布

问题:

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;```