Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 原则2:实体没有名为x的字段或关联_Php_Exception_Doctrine Orm_Associations_Dql - Fatal编程技术网

Php 原则2:实体没有名为x的字段或关联

Php 原则2:实体没有名为x的字段或关联,php,exception,doctrine-orm,associations,dql,Php,Exception,Doctrine Orm,Associations,Dql,我在使用doctrine执行DQL的简单请求时遇到了一些问题。 在我的代码中找不到任何错误,所以我在这里问我的问题 以下是我尝试执行的dcontrine查询: $em->createQueryBuilder()->select('p') ->from('\lib\models\HarvestPage', 'p') ->where('(p.start_hp + ?1 <= p.end_hp OR p.end_hp = 0) AND p.label_hp NOT

我在使用doctrine执行DQL的简单请求时遇到了一些问题。 在我的代码中找不到任何错误,所以我在这里问我的问题

以下是我尝试执行的dcontrine查询:

$em->createQueryBuilder()->select('p')
  ->from('\lib\models\HarvestPage', 'p')
  ->where('(p.start_hp + ?1 <= p.end_hp OR p.end_hp = 0) AND p.label_hp NOT IN (SELECT r.label_hp FROM \lib\models\HarvestRequest r)')
  ->setMaxResults(1)
  ->setParameter(1, $nbPages)
  ->getQuery()
  ->useResultCache(false)
  ->getOneOrNullResult();
最后是页面实体:

namespace lib\models;

/**
 * @Entity
 * @Table(name="harvest_page")
 */ 
class HarvestPage {
    /** @Id @Column(type="string", length=25) */
    private $label_hp;
    /** @Column(type="string", length=200, nullable=false) */
    private $link_hp;
    /** @Colum(type="smallint", nullable=false) */
    private $start_hp;
    /** @Colum(type="smallint", nullable=false) */
    private $end_hp;
}
表“harvest_page”已正确创建和填充。 我尝试了一些修复,但没有成功:

  • 取消激活缓存
  • 尝试重命名该字段

我该怎么解决呢?

元数据中有
@Column
,应该是
@Column

没问题,很高兴我能帮上忙
namespace lib\models;

/**
 * @Entity
 * @Table(name="harvest_page")
 */ 
class HarvestPage {
    /** @Id @Column(type="string", length=25) */
    private $label_hp;
    /** @Column(type="string", length=200, nullable=false) */
    private $link_hp;
    /** @Colum(type="smallint", nullable=false) */
    private $start_hp;
    /** @Colum(type="smallint", nullable=false) */
    private $end_hp;
}