return $this->entityManager
->createQueryBuilder()
->select('cac.fkClient', 'cac.fkIndividualConsultation', 'cac.dateAdded', 'cac.fkWorker')
->from(ClientActivityIndividualConsultationHistory::class, 'cac')
->where('cac.dateAdded BETWEEN :startDate AND :endDate')
->andWhere('cac . fkWorker = :workerId')
->setParameters([
'startDate' => $dateStart,
'dateEnd' => $dateEnd,
'workerId' => $workerId
])
->getQuery()
->getArrayResult();
Error message:
[Semantical Error] line 0, col 11 near 'fkClient, cac.fkIndividualConsultation,': Error: Invalid PathExpression. Must be a StateFieldPathExpression.
ORM:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Sepc\Bundle\WebBundle\Entity\ClientActivityIndividualConsultationHistory"
table="client_activity_individual_consultation_history">
<indexes>
<index name="fk_client_activity_individual_consulation_history_worker_id" columns="fk_worker_id"/>
<index name="fk_client_activity_individual_consulation_history_client_id" columns="fk_client_id"/>
<index name="fk_client_individual_consulation_history_consultation_id"
columns="fk_individual_consultation_id"/>
</indexes>
<id name="id" type="integer" column="id">
<generator strategy="IDENTITY"/>
</id>
<field name="dateAdded" type="datetime" column="date_added" nullable="false">
<options>
<option name="default">CURRENT_TIMESTAMP</option>
</options>
</field>
<many-to-one field="fkClient" target-entity="Client" fetch="LAZY">
<join-columns>
<join-column name="fk_client_id" referenced-column-name="id"/>
</join-columns>
</many-to-one>
<many-to-one field="fkWorker" target-entity="Worker" fetch="LAZY">
<join-columns>
<join-column name="fk_worker_id" referenced-column-name="id"/>
</join-columns>
</many-to-one>
<many-to-one field="fkIndividualConsultation" target-entity="CalendarIndividualConsultation" fetch="LAZY">
<join-columns>
<join-column name="fk_individual_consultation_id" referenced-column-name="id"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
I tried everything ( stackoverflow, google, own expierences ) but I really don't know where can be problem. Can somebody explain me this error or navigate me to right way? Thanks.
I do not want to use IDENTITY function because I need all data asociated with foreign keys. ( Doctrine automatically select these objects and I think that this can generate error, but why? )
Using: Symfony FW, Doctrine 2 ORM, MySQL
My tips:
- Bad ORM generated files
- QueryBuilder bug