Symfony API PLATFROM-对于不可为null的字段User.isActive,查询无法返回null

Symfony API PLATFROM-对于不可为null的字段User.isActive,查询无法返回null,symfony,annotations,graphql,Symfony,Annotations,Graphql,我面临的问题是如何轻松查询API-PLATFROM。 GraphQL游乐场: { users{ edges{ node{ id email isActive } } } } 错误: “debugMessage”:“无法为不可为null的字段用户返回null。isActive.”,与我为createdAt字段返回的错误相同 Symfony实体: <?php /** * @ORM\Entity(re

我面临的问题是如何轻松查询API-PLATFROM。 GraphQL游乐场:

{
  users{
    edges{
      node{
       id
        email
      isActive
      }
    }
  }
}
错误: “debugMessage”:“无法为不可为null的字段用户返回null。isActive.”,与我为createdAt字段返回的错误相同

Symfony实体:

<?php

/**
 * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
 * @ApiResource(
 *     normalizationContext={"groups"={"read"}},
 *     denormalizationContext={"groups"={"write"}}
 * )
 */
class User implements UserInterface
{
    /**
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=180, unique=true)
     * @Assert\NotNull
     * @Assert\Email
     * @Groups({"read","write"})
     */
    private $email;

    /**
     * @ORM\Column(type="boolean")
     * @Assert\NotNull
     * @Groups({"read","write"})
     */
    private $isActive;

    public function getIsActive(): bool
    {
        return $this->isActive;
    }

    public function setIsActive(bool $isActive): self
    {
        $this->isActive = $isActive;

        return $this;
    }
}

private$isActive=true;也应该初始化电子邮件。这样,您的实体始终处于正确初始化的状态。谢谢您的回答,但不幸的是仍然无法工作。isActive设置为true,fixtures将数据加载到数据库中。db结构已选中,isActive设置的值?