最近,一段代码停止工作。我没有做任何改变,所以我不知道为什么。
代码如下:
$invites = $this->vault_em->getRepository('AppBundle:Invite\LocalInvite')->findBy([
'active' => true,
]);
现在,它返回一个空数组,即使存在active=1的localinvite记录。
以下是原则Map:
/**
* @ORM\Entity
* @ORM\Table(name="invite")
*/
class LocalInvite extends Invite {
//...
}
/**@ORM\MappedSuperclass */
abstract class Invite implements \JsonSerializable {
/**@ORM\Column(type="boolean", options={"default": true}) */
protected $active;
//...
}
为了进行调试,我从调试日志中复制了正在执行的底层mysql查询:
SELECT t0.id AS id_1, t0.email AS email_2, t0.active AS active_3, t0.location AS location_4, t0.cohort_leadership AS cohort_leadership_5, t0.timezone AS timezone_6, t0.date_record_created AS date_record_created_7, t0.date_record_deleted AS date_record_deleted_8, t0.date_restart AS date_restart_9, t0.date_start_invite AS date_start_invite_10, t0.employee_id AS employee_id_11, t0.first_name AS first_name_12, t0.corporate_client_name AS corporate_client_name_13, t0.client_id AS client_id_14, t0.landing_page_url AS landing_page_url_15, t0.user_id AS user_id_16, t0.recipient_id AS recipient_id_17 FROM invite t0 WHERE t0.active = true;
当我将该查询插入mysql ide时,它会返回结果。
为什么findby不返回结果?
1条答案
按热度按时间tyg4sfes1#
试着改变
'AppBundle:Invite\LocalInvite'
由LocalInvite::class