Reputation: 23
I've some troubles while using doctrine to do a simple request by DQL. Can't find any error in my code, so I ask my question here.
Here is the dcotrine query I tried to execute :
$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();
It throws me this exception :
[Semantical Error] line 0, col 49 near 'start_hp + ?1': Error: Class lib\models\HarvestPage has no field or association named start_hp
And last, the HarvestPage entity :
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;
}
The table "harvest_page" is correctly created and populated. I've tried some fixes but without success :
How can I fix that?
Upvotes: 2
Views: 5160