An exception is thrown because of a line in my code:
$acadObj = $em->getRepository('ProjectMyBundle:Academie')->find($acadDeleg);
where $acadDeleg
is a string that I retrieve from a data source.
Generally, the official documentation uses find($id)
where $id
is a number (an integer). For that, I'm asking if it is possible to use strings. The thing is I have a table from which I have to get a value that I compare with another one, so that I can create an object.
For the record, $acadDeleg
is the primary key of the Academie
Entity
EDIT :
The Exception message :
The Exception message :
An exception occurred while executing 'SELECT t1.codeLieu AS codeLieu2, t1.nomLieu AS nomLieu3, t1.latLieu AS latLieu4, t1.lngLieu AS lngLieu5 FROM Academie t1 WHERE t0.codeLieu = ?' with params {"1":"A"}:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 't0.codeLieu' in 'where clause'
The Academie definition :
<?php
namespace PFA\SIGBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Academie
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="PFA\SIGBundle\Entity\AcademieRepository")
*/
class Academie extends Lieu
{
}
The Lieu definition :
<?php
namespace PFA\SIGBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Lieu
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="PFA\SIGBundle\Entity\LieuRepository")
*/
abstract class Lieu
{
/**
* @var string
*
* @ORM\Column(name="codeLieu", type="string", length=20)
* @ORM\Id
*/
private $codeLieu;
/**
* @var string
*
* @ORM\Column(name="nomLieu", type="string",nullable=true)
*/
private $nomLieu;
/**
* @var float
*
* @ORM\Column(name="latLieu", type="float", nullable=true)
*/
private $latLieu;
/**
* @var float
*
* @ORM\Column(name="lngLieu", type="float", nullable=true)
*/
private $lngLieu;
// getters and setters here...
}