Notice: Undefined index: user issue - symfony

Why do I get Notice: Undefined index: user in /Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php line 111?
The query:
$res = $em->createQueryBuilder()
->select(array('u', 'u2p'))
->from('HoaxPartnerBundle:FooUsers2FooPartner', 'u2p')
->innerJoin('u2p.user', 'u', 'WITH', "u.userid = :userid")
->where('u2p.partner = :partner_id')
->setParameter('userid', $userid)
->setParameter('partner_id', $partner->getId())
->getQuery()
->getSingleResult();
FooUsers:
/**
* FooUsers
*
* #ORM\Table(name="Foo_users", uniqueConstraints={#ORM\UniqueConstraint(name="search_userid", columns={"userid"})})
* #ORM\Entity
* #ORM\HasLifecycleCallbacks
* #UniqueEntity(fields="userid")
*/
class FooUsers
{
/**
* #var integer
*
* #ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* #var string
*
* #Assert\NotBlank()
* #ORM\Column(name="userid", type="string", length=255, nullable=false)
*/
private $userid;
/**
* #var string
*
* #Assert\NotBlank()
* #ORM\Column(name="password", type="string", length=255, nullable=false)
*/
private $password;
/**
* #var string
*
* #Assert\NotBlank()
* #ORM\Column(name="Foo_password", type="string", length=10, nullable=false)
*/
private $Foo_password;
/**
* #var string
*
* #ORM\Column(name="email", type="string", length=255, nullable=true)
*/
private $email;
/**
* #var string
*
* #Assert\Type("int")
* #Assert\NotBlank()
* #Assert\Range(
* min = 0,
* max = 1,
* minMessage = "Min allowed is 0",
* maxMessage = "Max allowed is 1"
* )
* #ORM\Column(name="status_id", type="integer", nullable=false)
*/
private $status_id;
/**
* #var string
*
* #ORM\Column(name="expire_account", type="datetime", nullable=true)
* #Assert\DateTime()
* #PartnerAssert\ValidSubscriptionValues()
*/
private $expire_account;
/**
* #var \DateTime
*
* #ORM\Column(name="created", type="datetime", nullable=false)
* #Assert\DateTime()
* #Assert\NotBlank()
*/
private $created;
/**
* #var \Hoax\PartnerBundle\Entity\FooUsers2FooPartner
*
* #ORM\OneToOne(
* targetEntity="\Hoax\PartnerBundle\Entity\FooUsers2FooPartner"
* , mappedBy="user"
* )
*/
private $toUser;
/**
* #ORM\PrePersist
* #return FooUsers
*/
public function createdTimeOnPrePersist()
{
$this->created = new \DateTime();
return $this;
}
/**
* #ORM\PrePersist
* #return FooUsers
*/
public function statusIdOnPrePersist()
{
$this->status_id = 0;
return $this;
}
/**
* Get id
*
* #return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set userid
*
* #param string $userid
* #return FooUsers
*/
public function setUserid($userid)
{
$this->userid = $userid;
return $this;
}
/**
* Get userid
*
* #return string
*/
public function getUserid()
{
return $this->userid;
}
/**
* Set password
*
* #param string $password
* #return FooUsers
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* Get Foo_password
*
* #return string
*/
public function getFooPassword()
{
return $this->Foo_password;
}
/**
* Set Foo_password
*
* #param string $password
* #return FooUsers
*/
public function setFooPassword($Foo_password)
{
$this->Foo_password = $Foo_password;
return $this;
}
/**
* Get password
*
* #return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Get created
*
* #return \DateTime
*/
public function getCreated()
{
// return $this->created->format('Y-m-d H:i:s');
}
/**
* Set email
*
* #param string $email
* #return FooUsers
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* #return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set status_id
*
* #param int $status_id
* #return FooUsers
*/
public function setStatusId($status_id)
{
$this->status_id = $status_id;
return $this;
}
/**
* Get status_id
*
* #return string
*/
public function getStatusId()
{
return $this->status_id;
}
/**
* Set expire_account
*
* #param \DateTime $expire_account
* #return FooUsers
*/
public function setExpireAccount($expire_account)
{
$this->expire_account = clone $expire_account;
return $this;
}
/**
* Get expire_account
*
* #return \DateTime
*/
public function getExpireAccount()
{
return is_object($this->expire_account)
? clone $this->expire_account
// : new \DateTime('now');
: $this->expire_account;
}
}
FooUsers2FooPartner:
/**
* FooUsers2FooPartner
*
* #ORM\Table(name="Foo_users2Foo_partner", uniqueConstraints={#ORM\UniqueConstraint(name="uniq_idx", columns={"partner_id", "user_id"})})
* #ORM\Entity(repositoryClass="Hoax\PartnerBundle\Entity\FooUsers2FooPartnerRepository")
*/
class FooUsers2FooPartner
{
/**
* #var integer
*
* #ORM\Column(name="id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* #var \Hoax\PartnerBundle\Entity\FooUsers
*
* #ORM\OneToOne(
* targetEntity="\Hoax\PartnerBundle\Entity\FooUsers"
* , cascade={"persist", "remove"}
* , inversedBy="user"
* )
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="user_id"
* , nullable=false
* , referencedColumnName="id"
* )
* })
*/
private $user;
/**
* #var \Hoax\PartnerBundle\Entity\FooPartner
*
* #ORM\ManyToOne(
* targetEntity="\Hoax\PartnerBundle\Entity\FooPartner"
* , cascade={"persist", "remove"}
* , inversedBy="partner"
* )
* #ORM\JoinColumns({
* #ORM\JoinColumn(
* name="partner_id"
* , nullable=false
* , referencedColumnName="id"
* )
* })
*/
private $partner;
/**
* Get id
*
* #return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set user
*
* #param i\Hoax\PartnerBundle\Entity\FooUsers
* #return FooUsers2FooPartner
*/
public function setUser(\Hoax\PartnerBundle\Entity\FooUsers $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* #return \Hoax\PartnerBundle\Entity\FooUsers
*/
public function getUser()
{
return $this->user;
}
/**
* Set partner
*
* #param \Hoax\PartnerBundle\Entity\FooPartner
* #return FooUsers2FooPartner
*/
public function setPartner(\Hoax\PartnerBundle\Entity\FooPartner $partner = null)
{
$this->partner = $partner;
return $this;
}
/**
* Get partner
*
* #return \Hoax\PartnerBundle\Entity\FooPartner
*/
public function getPartner()
{
return $this->partner;
}
}
I can see query in MySQL log and it looks good to me:
SELECT ... FROM foo_users2foo_partner v0_
INNER JOIN foo_users v1_
ON v0_.user_id = v1_.id
AND (v1_.userid = 'mgH4MlBg')
WHERE v0_.partner_id = 1

In FooUsers2FooPartner you have an incorrect inversedBy, it should be toUser and not user.

Related

"Missing value for primary key"

I'd just migrated to Symfony 3.4 and had this kind of message :
request.CRITICAL: Uncaught PHP Exception Doctrine\Common\Proxy\Exception\OutOfBoundsException: "Missing value for primary key idBen on Lea\PrestaBundle\Entity\EgwContact" at /htdocs/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php line 40
Thanks in advance for your help
Here is my entity code for egw_contact :
<?php
namespace Lea\PrestaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Lea\PrestaBundle\Entity\EgwContact
*
* #ORM\Table(name="egw_contact")
* #ORM\Entity(repositoryClass="Lea\PrestaBundle\Entity\EgwContactRepository")
*/
class EgwContact
{
/**
* #var integer $idBen
*
* #ORM\Column(name="id_ben", type="integer", nullable=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="AUTO")
*/
private $idBen;
/**
* #var string $idOrganisation
*
* #ORM\Column(name="id_organisation", type="string", length=64, nullable=true)
*/
private $idOrganisation;
/**
* #var integer $idOwner
*
* #ORM\Column(name="id_owner", type="bigint", nullable=false)
*/
private $idOwner;
/**
* #var integer $dateCreation
*
* #ORM\Column(name="date_creation", type="bigint", nullable=false)
*/
private $dateCreation;
/**
* #var integer $idModifier
*
* #ORM\Column(name="id_modifier", type="bigint", nullable=false)
*/
private $idModifier;
/**
* #var integer $dateLastModified
*
* #ORM\Column(name="date_last_modified", type="bigint", nullable=false)
*/
private $dateLastModified;
/**
* #var string $catId
*
* #ORM\Column(name="cat_id", type="string", length=32, nullable=false)
*/
private $catId;
/**
* #var string $civilite
*
* #ORM\Column(name="civilite", type="string", length=64, nullable=false)
*/
private $civilite;
/**
* #var string $nomComplet
*
* #ORM\Column(name="nom_complet", type="string", length=64, nullable=false)
*/
private $nomComplet;
/**
* #var string $nom
*
* #ORM\Column(name="nom", type="string", length=64, nullable=false)
*/
private $nom;
/**
* #var string $prenom
*
* #ORM\Column(name="prenom", type="string", length=64, nullable=false)
*/
private $prenom;
/**
* #var string $deuxiemePrenom
*
* #ORM\Column(name="deuxieme_prenom", type="string", length=64, nullable=false)
*/
private $deuxiemePrenom;
/**
* #var string $nomJeuneFille
*
* #ORM\Column(name="nom_jeune_fille", type="string", length=64, nullable=false)
*/
private $nomJeuneFille;
/**
* #var string $organisation
*
* #ORM\Column(name="organisation", type="string", length=64, nullable=false)
*/
private $organisation;
/**
* #var string $fonction
*
* #ORM\Column(name="fonction", type="string", length=64, nullable=false)
*/
private $fonction;
/**
* #var string $service
*
* #ORM\Column(name="Service", type="string", length=64, nullable=false)
*/
private $service;
/**
* #var string $adresseLigne1
*
* #ORM\Column(name="adresse_ligne_1", type="string", length=64, nullable=false)
*/
private $adresseLigne1;
/**
* #var string $adresseLigne2
*
* #ORM\Column(name="adresse_ligne_2", type="string", length=64, nullable=false)
*/
private $adresseLigne2;
/**
* #var string $adresseLigne3
*
* #ORM\Column(name="adresse_ligne_3", type="string", length=64, nullable=false)
*/
private $adresseLigne3;
/**
* #var string $ville
*
* #ORM\Column(name="ville", type="string", length=64, nullable=false)
*/
private $ville;
/**
* #var string $region
*
* #ORM\Column(name="region", type="string", length=64, nullable=false)
*/
private $region;
/**
* #var string $cp
*
* #ORM\Column(name="cp", type="string", length=64, nullable=false)
*/
private $cp;
/**
* #var string $pays
*
* #ORM\Column(name="pays", type="string", length=64, nullable=false)
*/
private $pays;
/**
* #var string $telPro1
*
* #ORM\Column(name="tel_pro_1", type="string", length=40, nullable=false)
*/
private $telPro1;
/**
* #var string $telPro2
*
* #ORM\Column(name="tel_pro_2", type="string", length=64, nullable=false)
*/
private $telPro2;
/**
* #var string $telDomicile1
*
* #ORM\Column(name="tel_domicile_1", type="string", length=14, nullable=false)
*/
private $telDomicile1;
/**
* #var string $telDomicile2
*
* #ORM\Column(name="tel_domicile_2", type="string", length=64, nullable=false)
*/
private $telDomicile2;
/**
* #var string $faxPro
*
* #ORM\Column(name="fax_pro", type="string", length=40, nullable=false)
*/
private $faxPro;
/**
* #var string $faxPerso
*
* #ORM\Column(name="fax_perso", type="string", length=64, nullable=false)
*/
private $faxPerso;
/**
* #var string $portablePro
*
* #ORM\Column(name="portable_pro", type="string", length=64, nullable=false)
*/
private $portablePro;
/**
* #var string $portablePerso
*
* #ORM\Column(name="portable_perso", type="string", length=40, nullable=false)
*/
private $portablePerso;
/**
* #var string $emailPro
*
* #ORM\Column(name="email_pro", type="string", length=64, nullable=false)
*/
private $emailPro;
/**
* #var string $emailPerso
*
* #ORM\Column(name="email_perso", type="string", length=64, nullable=false)
*/
private $emailPerso;
/**
* #var string $sitePerso
*
* #ORM\Column(name="site_perso", type="string", length=64, nullable=false)
*/
private $sitePerso;
/**
* #var string $dateNaissance
*
* #ORM\Column(name="date_naissance", type="string", length=64, nullable=false)
*/
private $dateNaissance;
/**
* #var string $lieuNaissance
*
* #ORM\Column(name="lieu_naissance", type="string", length=64, nullable=false)
*/
private $lieuNaissance;
/**
* #var string $paysNaissance
*
* #ORM\Column(name="pays_naissance", type="string", length=64, nullable=false)
*/
private $paysNaissance;
/**
* #var string $nationalite
*
* #ORM\Column(name="nationalite", type="string", length=64, nullable=false)
*/
private $nationalite;
/**
* #var string $situationMaritale
*
* #ORM\Column(name="situation_maritale", type="string", length=64, nullable=false)
*/
private $situationMaritale;
/**
* #var integer $enfantsACharge
*
* #ORM\Column(name="enfants_a_charge", type="integer", nullable=false)
*/
private $enfantsACharge;
/**
* #var integer $idSecu
*
* #ORM\Column(name="numero_SS", type="string", nullable=false)
*/
private $idSecu;
/**
* #ORM\OneToMany(targetEntity="EgwCategories", mappedBy="contactCategorie")
*/
private $typeContact;
/**
* #ORM\OneToMany(targetEntity="Relance", mappedBy="contact")
*
*/
protected $relances;
/**
* #ORM\OneToMany(targetEntity="EgwProjet", mappedBy="contact")
*/
protected $projets;
/**
* #ORM\OneToMany(targetEntity="EgwPrestation", mappedBy="contact")
*/
protected $prestations;
/**
* #ORM\OneToMany(targetEntity="EgwPrestation", mappedBy="contactP")
*/
protected $prestationsP;
/**
* #ORM\OneToMany(targetEntity="EgwContactParcoursPro", mappedBy="parcoursProContact")
*/
protected $contactParcoursPro;
/**
* #ORM\OneToMany(targetEntity="EgwContactFormation", mappedBy="formationContact")
*/
protected $contactFormation;
public function __construct()
{
$this->prestations = new ArrayCollection();
$this->prestationsP = new ArrayCollection();
$this->contactParcoursPro = new ArrayCollection();
$this->contactFormation = new ArrayCollection();
$this->typeContact = new ArrayCollection();
$this->projets = new ArrayCollection();
}
/**
* Get idBen
*
* #return integer
*/
public function getIdBen()
{
return $this->idBen;
}
/**
* Set idOrganisation
*
* #param string $idOrganisation
* #return EgwContact
*/
public function setIdOrganisation($idOrganisation = null)
{
$this->idOrganisation = $idOrganisation;
return $this;
}
/**
* Get idOrganisation
*
* #return string
*/
public function getIdOrganisation()
{
return $this->idOrganisation;
}
/**
* Set idOwner
*
* #param integer $idOwner
* #return EgwContact
*/
public function setIdOwner($idOwner)
{
$this->idOwner = $idOwner;
return $this;
}
/**
* Get idOwner
*
* #return integer
*/
public function getIdOwner()
{
return $this->idOwner;
}
/**
* Set dateCreation
*
* #param integer $dateCreation
* #return EgwContact
*/
public function setDateCreation($dateCreation)
{
$this->dateCreation = $dateCreation;
return $this;
}
/**
* Get dateCreation
*
* #return integer
*/
public function getDateCreation()
{
return $this->dateCreation;
}
/**
* Set idModifier
*
* #param integer $idModifier
* #return EgwContact
*/
public function setIdModifier($idModifier)
{
$this->idModifier = $idModifier;
return $this;
}
/**
* Get idModifier
*
* #return integer
*/
public function getIdModifier()
{
return $this->idModifier;
}
/**
* Set dateLastModified
*
* #param integer $dateLastModified
* #return EgwContact
*/
public function setDateLastModified($dateLastModified)
{
$this->dateLastModified = $dateLastModified;
return $this;
}
/**
* Get dateLastModified
*
* #return integer
*/
public function getDateLastModified()
{
return $this->dateLastModified;
}
/**
* Set catId
*
* #param string $catId
* #return EgwContact
*/
public function setCatId($catId)
{
$this->catId = $catId;
return $this;
}
/**
* Get catId
*
* #return string
*/
public function getCatId()
{
return $this->catId;
}
/**
* Set civilite
*
* #param string $civilite
* #return EgwContact
*/
public function setCivilite($civilite)
{
$this->civilite = $civilite;
return $this;
}
/**
* Get civilite
*
* #return string
*/
public function getCivilite()
{
return $this->civilite;
}
/**
* Set nomComplet
*
* #param string $nomComplet
* #return EgwContact
*/
public function setNomComplet($nomComplet)
{
$this->nomComplet = $nomComplet;
return $this;
}
/**
* Get nomComplet
*
* #return string
*/
public function getNomComplet()
{
return $this->nomComplet;
}
/**
* Set nom
*
* #param string $nom
* #return EgwContact
*/
public function setNom($nom)
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* #return string
*/
public function getNom()
{
return $this->nom;
}
/**
* Set prenom
*
* #param string $prenom
* #return EgwContact
*/
public function setPrenom($prenom)
{
$this->prenom = $prenom;
return $this;
}
/**
* Get prenom
*
* #return string
*/
public function getPrenom()
{
return $this->prenom;
}
/**
* Set deuxiemePrenom
*
* #param string $deuxiemePrenom
* #return EgwContact
*/
public function setDeuxiemePrenom($deuxiemePrenom)
{
$this->deuxiemePrenom = $deuxiemePrenom;
return $this;
}
/**
* Get deuxiemePrenom
*
* #return string
*/
public function getDeuxiemePrenom()
{
return $this->deuxiemePrenom;
}
/**
* Set nomJeuneFille
*
* #param string $nomJeuneFille
* #return EgwContact
*/
public function setNomJeuneFille($nomJeuneFille)
{
$this->nomJeuneFille = $nomJeuneFille;
return $this;
}
/**
* Get nomJeuneFille
*
* #return string
*/
public function getNomJeuneFille()
{
return $this->nomJeuneFille;
}
/**
* Set organisation
*
* #param string $organisation
* #return EgwContact
*/
public function setOrganisation($organisation)
{
$this->organisation = $organisation;
return $this;
}
/**
* Get organisation
*
* #return string
*/
public function getOrganisation()
{
return $this->organisation;
}
/**
* Set fonction
*
* #param string $fonction
* #return EgwContact
*/
public function setFonction($fonction)
{
$this->fonction = $fonction;
return $this;
}
/**
* Get fonction
*
* #return string
*/
public function getFonction()
{
return $this->fonction;
}
/**
* Set service
*
* #param string $service
* #return EgwContact
*/
public function setService($service)
{
$this->service = $service;
return $this;
}
/**
* Get service
*
* #return string
*/
public function getService()
{
return $this->service;
}
/**
* Set adresseLigne1
*
* #param string $adresseLigne1
* #return EgwContact
*/
public function setAdresseLigne1($adresseLigne1)
{
$this->adresseLigne1 = $adresseLigne1;
return $this;
}
/**
* Get adresseLigne1
*
* #return string
*/
public function getAdresseLigne1()
{
return $this->adresseLigne1;
}
/**
* Set adresseLigne2
*
* #param string $adresseLigne2
* #return EgwContact
*/
public function setAdresseLigne2($adresseLigne2)
{
$this->adresseLigne2 = $adresseLigne2;
return $this;
}
/**
* Get adresseLigne2
*
* #return string
*/
public function getAdresseLigne2()
{
return $this->adresseLigne2;
}
/**
* Set adresseLigne3
*
* #param string $adresseLigne3
* #return EgwContact
*/
public function setAdresseLigne3($adresseLigne3)
{
$this->adresseLigne3 = $adresseLigne3;
return $this;
}
/**
* Get adresseLigne3
*
* #return string
*/
public function getAdresseLigne3()
{
return $this->adresseLigne3;
}
/**
* Set ville
*
* #param string $ville
* #return EgwContact
*/
public function setVille($ville)
{
$this->ville = $ville;
return $this;
}
/**
* Get ville
*
* #return string
*/
public function getVille()
{
return $this->ville;
}
/**
* Set region
*
* #param string $region
* #return EgwContact
*/
public function setRegion($region)
{
$this->region = $region;
return $this;
}
/**
* Get region
*
* #return string
*/
public function getRegion()
{
return $this->region;
}
/**
* Set cp
*
* #param string $cp
* #return EgwContact
*/
public function setCp($cp)
{
$this->cp = $cp;
return $this;
}
/**
* Get cp
*
* #return string
*/
public function getCp()
{
return $this->cp;
}
/**
* Set pays
*
* #param string $pays
* #return EgwContact
*/
public function setPays($pays)
{
$this->pays = $pays;
return $this;
}
/**
* Get pays
*
* #return string
*/
public function getPays()
{
return $this->pays;
}
/**
* Set telPro1
*
* #param string $telPro1
* #return EgwContact
*/
public function setTelPro1($telPro1)
{
$this->telPro1 = $telPro1;
return $this;
}
/**
* Get telPro1
*
* #return string
*/
public function getTelPro1()
{
return $this->telPro1;
}
/**
* Set telPro2
*
* #param string $telPro2
* #return EgwContact
*/
public function setTelPro2($telPro2)
{
$this->telPro2 = $telPro2;
return $this;
}
/**
* Get telPro2
*
* #return string
*/
public function getTelPro2()
{
return $this->telPro2;
}
/**
* Set telDomicile1
*
* #param string $telDomicile1
* #return EgwContact
*/
public function setTelDomicile1($telDomicile1)
{
$this->telDomicile1 = $telDomicile1;
return $this;
}
/**
* Get telDomicile1
*
* #return string
*/
public function getTelDomicile1()
{
return $this->telDomicile1;
}
/**
* Set telDomicile2
*
* #param string $telDomicile2
* #return EgwContact
*/
public function setTelDomicile2($telDomicile2)
{
$this->telDomicile2 = $telDomicile2;
return $this;
}
/**
* Get telDomicile2
*
* #return string
*/
public function getTelDomicile2()
{
return $this->telDomicile2;
}
/**
* Set faxPro
*
* #param string $faxPro
* #return EgwContact
*/
public function setFaxPro($faxPro)
{
$this->faxPro = $faxPro;
return $this;
}
/**
* Get faxPro
*
* #return string
*/
public function getFaxPro()
{
return $this->faxPro;
}
/**
* Set faxPerso
*
* #param string $faxPerso
* #return EgwContact
*/
public function setFaxPerso($faxPerso)
{
$this->faxPerso = $faxPerso;
return $this;
}
/**
* Get faxPerso
*
* #return string
*/
public function getFaxPerso()
{
return $this->faxPerso;
}
/**
* Set portablePro
*
* #param string $portablePro
* #return EgwContact
*/
public function setPortablePro($portablePro)
{
$this->portablePro = $portablePro;
return $this;
}
/**
* Get portablePro
*
* #return string
*/
public function getPortablePro()
{
return $this->portablePro;
}
/**
* Set portablePerso
*
* #param string $portablePerso
* #return EgwContact
*/
public function setPortablePerso($portablePerso)
{
$this->portablePerso = $portablePerso;
return $this;
}
/**
* Get portablePerso
*
* #return string
*/
public function getPortablePerso()
{
return $this->portablePerso;
}
/**
* Set emailPro
*
* #param string $emailPro
* #return EgwContact
*/
public function setEmailPro($emailPro)
{
$this->emailPro = $emailPro;
return $this;
}
/**
* Get emailPro
*
* #return string
*/
public function getEmailPro()
{
return $this->emailPro;
}
/**
* Set emailPerso
*
* #param string $emailPerso
* #return EgwContact
*/
public function setEmailPerso($emailPerso)
{
$this->emailPerso = $emailPerso;
return $this;
}
/**
* Get emailPerso
*
* #return string
*/
public function getEmailPerso()
{
return $this->emailPerso;
}
/**
* Set sitePerso
*
* #param string $sitePerso
* #return EgwContact
*/
public function setSitePerso($sitePerso)
{
$this->sitePerso = $sitePerso;
return $this;
}
/**
* Get sitePerso
*
* #return string
*/
public function getSitePerso()
{
return $this->sitePerso;
}
/**
* Set dateNaissance
*
* #param string $dateNaissance
* #return EgwContact
*/
public function setDateNaissance($dateNaissance)
{
$this->dateNaissance = $dateNaissance;
return $this;
}
/**
* Get dateNaissance
*
* #return string
*/
public function getDateNaissance()
{
return $this->dateNaissance;
}
/**
* Set lieuNaissance
*
* #param string $lieuNaissance
* #return EgwContact
*/
public function setLieuNaissance($lieuNaissance)
{
$this->lieuNaissance = $lieuNaissance;
return $this;
}
/**
* Get lieuNaissance
*
* #return string
*/
public function getLieuNaissance()
{
return $this->lieuNaissance;
}
/**
* Set paysNaissance
*
* #param string $paysNaissance
* #return EgwContact
*/
public function setPaysNaissance($paysNaissance)
{
$this->paysNaissance = $paysNaissance;
return $this;
}
/**
* Get paysNaissance
*
* #return string
*/
public function getPaysNaissance()
{
return $this->paysNaissance;
}
/**
* Set nationalite
*
* #param string $nationalite
* #return EgwContact
*/
public function setNationalite($nationalite)
{
$this->nationalite = $nationalite;
return $this;
}
/**
* Get nationalite
*
* #return string
*/
public function getNationalite()
{
return $this->nationalite;
}
/**
* Set situationMaritale
*
* #param string $situationMaritale
* #return EgwContact
*/
public function setSituationMaritale($situationMaritale)
{
$this->situationMaritale = $situationMaritale;
return $this;
}
/**
* Get situationMaritale
*
* #return string
*/
public function getSituationMaritale()
{
return $this->situationMaritale;
}
/**
* Set enfantsACharge
*
* #param integer $enfantsACharge
* #return EgwContact
*/
public function setEnfantsACharge($enfantsACharge)
{
$this->enfantsACharge = $enfantsACharge;
return $this;
}
/**
* Get enfantsACharge
*
* #return integer
*/
public function getEnfantsACharge()
{
return $this->enfantsACharge;
}
/**
* Set idSecu
*
* #param integer $idSecu
* #return EgwContact
*/
public function setIdSecu($idSecu)
{
$this->idSecu = $idSecu;
return $this;
}
/**
* Get idSecu
*
* #return string
*/
public function getidSecu()
{
return $this->idSecu;
}
/**
* Add typeContact
*
* #param Lea\PrestaBundle\Entity\EgwContact $typeContact
* #return EgwContact
etc...
...
}
I FOUND ! in a Form calling the entity Ewg_contact linked to the entity Ewg_Categories, there was a hard parameter called: I replaced it with a variable. And it works.
This is by looking at the getProxy () function of the Doctrine class AbstractProxyFactory.php: there is an exception that calls the OutOfBoundsException :: missingPrimaryKeyValue function in which there is the message "
Missing value for primary key
Here is the correction made to the Form in question:
$param287=287;
$builder->add('categorie', EntityType::class, array(
'class' => 'LeaPrestaBundle:EgwCategories',
'label' => 'catName',
'required' => true,
'empty_data' => null,
'query_builder' => function(EntityRepository $er)
{
return $er->createQueryBuilder('c')
->where('c.catParent = :parent')
->setParameter('parent',$param287 )
->orderBy('c.catName','ASC');
},
));
EXPLANATION : Before it was :
->setParameter('parent', 287 )
witch provocated an exception in the getproxy function of AbstractProxyFactory.php class
Correct now
Thanks for your messages
i have the same problem. I found a possible "solution" in Doctrine Documentation. This one maybe can help.
i see in Documentation it's not possible to use not-primary key for joins columns.
Your column id_ben is a primary key ?
It is not possible to use join columns pointing to non-primary keys. Doctrine will think these are the primary keys and create lazy-loading proxies with the data, which can lead to unexpected results. Doctrine can for performance reasons not validate the correctness of this settings at runtime but only through the Validate Schema command.
It's probably a problem between 2 entities 👍
The link between entities egw_accounts and egw_addressbook is : ACCOUNT_ID
In the database, about the field ACCOUNT_ID there are exactly the same values in entities egw_accounts and egw_addressbook 👍
egw_accounts->ACCOUNT_ID = egw_addressbook->ACCOUNT_ID
SO, perhaps it's in the definition of entities that there's a problem
Remember that, i didnt have the problem in SYMFONY 2 : but in SYMFONY 3.4, the problem appears
THANKS for your help!
ENTITY EGW_ACCOUNTS 👍
class EgwAccounts { /** * #var integer $accountId * * #ORM\Id * #ORM\GeneratedValue(strategy="IDENTITY") * #ORM\OneToOne(targetEntity="EgwAddressbook", cascade={"persist", "merge", "remove"}) * #ORM\JoinColumn(name="account_id", referencedColumnName="account_id") */ private $accountId;
With the SETTER :
`
/**
* Set accountId
*
* #param Lea\PrestaBundle\Entity\EgwAddressbook $accountId
* #return EgwAccounts
*/
public function setAccountId(\Lea\PrestaBundle\Entity\EgwAddressbook $accountId)
{
$this->accountId = $accountId;
return $this;
}`
THE ENTITY EGW_ADDRESSBOOK 👍
/** * #var integer $accountId * #ORM\Column(name="account_id", type="integer", nullable=true) */ private $accountId;

Doctrine Relation One-To-Many don't show all results in Synfony 2

I'm on Symfony 2.8.15 and I have a problem with a doctrine relation One-To-Many.
I have an entity InvitesGroupe and an entity Reservations. InvitesGroupe can have One or Many Reservations. So there is a hasReservations() method in.
It works, my application is in production for month. But recently I see a huge result : Not all possibilities are shown. I have an InviteGroupe which have 43 Reservations in the database, all the same format apart the date but only 42 are shown.
If a try the query from the profiler, I have the 43 reservations.
I try many debug, but I don't know what append.
the (owning) InvitesGroupe entities :
<?php
namespace Ipb\AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* InvitesGroupe
*
* #ORM\Table(name="invites_groupe", indexes={#ORM\Index(name="FK_invites_groupe_id_service", columns={"id_service"})})
* #ORM\Entity(repositoryClass="Ipb\AppBundle\EntityRepository\InvitesGroupeRepository")
*/
class InvitesGroupe
{
/**
* #var integer
*
* #ORM\Column(name="id_invite", type="integer", precision=0, scale=0, nullable=false, unique=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $idInvite;
/**
* #var integer
*
* #ORM\Column(name="nombre", type="integer", precision=0, scale=0, nullable=true, unique=false)
*/
private $nombre;
/**
* #var string
*
* #ORM\Column(name="nom_reservation", type="string", length=30, precision=0, scale=0, nullable=true, unique=false)
*
* #Assert\NotBlank()
* #Assert\Length(max = 30)
*
*/
private $nomReservation;
/**
* #var string
*
* #ORM\Column(name="commentaire", type="text", length=65535, precision=0, scale=0, nullable=true, unique=false)
*
* #Assert\NotBlank()
*
*/
private $commentaire;
/**
* #var boolean
*
* #ORM\Column(name="repas", type="boolean", precision=0, scale=0, nullable=true, unique=false)
*/
private $repas = 1;
/**
* #var boolean
*
* #ORM\Column(name="repas_offert", type="boolean", precision=0, scale=0, nullable=false, unique=false)
*/
private $repasOffert = false;
/**
* #var integer
*
* #ORM\Column(name="place_table", type="integer", precision=0, scale=0, nullable=true, unique=false)
*
* #Assert\NotBlank()
*
*/
private $placeTable;
/**
* #var boolean
*
* #ORM\Column(name="invite_visible", type="boolean", precision=0, scale=0, nullable=false, unique=false)
*/
private $inviteVisible = true;
/**
* #var \Ipb\AppBundle\Entity\Users
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\Users")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_user", referencedColumnName="id_user", nullable=true)
* })
*/
private $idUser;
/**
* #var boolean
*
* #ORM\Column(name="dessert", type="boolean", precision=0, scale=0, nullable=false, unique=false)
*/
private $dessert = false;
/**
* #var boolean
*
* #ORM\Column(name="wine", type="boolean", precision=0, scale=0, nullable=false, unique=false)
*/
private $wine = false;
/**
* #var boolean
*
* #ORM\Column(name="coffee", type="boolean", precision=0, scale=0, nullable=false, unique=false)
*/
private $coffee = false;
/**
* #var boolean
*
* #ORM\Column(name="invite_temporaire", type="boolean", precision=0, scale=0, nullable=true, unique=false)
*/
private $inviteTemporaire;
/**
* #var \Ipb\AppBundle\Entity\Services
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\Services")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_service", referencedColumnName="id_service", nullable=true)
* })
*/
private $idService;
/**
*
* #ORM\OneToMany(targetEntity="Ipb\AppBundle\Entity\Reservations", mappedBy="invitesGroupe", cascade={"persist","remove"})
*/
private $reservations;
/**
* Get idInvite
*
* #return integer
*/
public function getIdInvite()
{
return $this->idInvite;
}
/**
* Set nombre
*
* #param integer $nombre
* #return InvitesGroupe
*/
public function setNombre($nombre)
{
$this->nombre = $nombre;
return $this;
}
/**
* Get nombre
*
* #return integer
*/
public function getNombre()
{
return $this->nombre;
}
/**
* Set nomReservation
*
* #param string $nomReservation
* #return InvitesGroupe
*/
public function setNomReservation($nomReservation)
{
$this->nomReservation = $nomReservation;
return $this;
}
/**
* Get nomReservation
*
* #return string
*/
public function getNomReservation()
{
return $this->nomReservation;
}
/**
* Set commentaire
*
* #param string $commentaire
* #return InvitesGroupe
*/
public function setCommentaire($commentaire)
{
$this->commentaire = $commentaire;
return $this;
}
/**
* Get commentaire
*
* #return string
*/
public function getCommentaire()
{
return $this->commentaire;
}
/**
* Set repas
*
* #param boolean $repas
* #return InvitesGroupe
*/
public function setRepas($repas)
{
$this->repas = $repas;
return $this;
}
/**
* Get repas
*
* #return boolean
*/
public function getRepas()
{
return $this->repas;
}
/**
* Set repasOffert
*
* #param boolean $repasOffert
* #return InvitesGroupe
*/
public function setRepasOffert($repasOffert)
{
$this->repasOffert = $repasOffert;
return $this;
}
/**
* Get repasOffert
*
* #return boolean
*/
public function getRepasOffert()
{
return $this->repasOffert;
}
/**
* Set placeTable
*
* #param integer $placeTable
* #return InvitesGroupe
*/
public function setPlaceTable($placeTable)
{
$this->placeTable = $placeTable;
return $this;
}
/**
* Get placeTable
*
* #return integer
*/
public function getPlaceTable()
{
return $this->placeTable;
}
/**
* Set inviteVisible
*
* #param boolean $inviteVisible
* #return InvitesGroupe
*/
public function setInviteVisible($inviteVisible)
{
$this->inviteVisible = $inviteVisible;
return $this;
}
/**
* Get inviteVisible
*
* #return boolean
*/
public function getInviteVisible()
{
return $this->inviteVisible;
}
/**
* Set dessert
*
* #param boolean $dessert
* #return InvitesGroupe
*/
public function setDessert($dessert)
{
$this->dessert = $dessert;
return $this;
}
/**
* Get dessert
*
* #return boolean
*/
public function getDessert()
{
return $this->dessert;
}
/**
* Set idService
*
* #param \Ipb\AppBundle\Entity\Services $idService
* #return InvitesGroupe
*/
public function setIdService(\Ipb\AppBundle\Entity\Services $idService = null)
{
$this->idService = $idService;
return $this;
}
/**
* Get idService
*
* #return \Ipb\AppBundle\Entity\Services
*/
public function getIdService()
{
return $this->idService;
}
/**
* Constructor
*/
public function __construct()
{
$this->reservations = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add reservations
*
* #param \Ipb\AppBundle\Entity\Reservations $reservations
* #return Reservations
*/
public function addReservation(\Ipb\AppBundle\Entity\Reservations $reservations)
{
$this->reservations[] = $reservations;
return $this;
}
/**
* Remove reservations
*
* #param \Ipb\AppBundle\Entity\Reservations $reservations
*/
public function removeReservation(\Ipb\AppBundle\Entity\Reservations $reservations)
{
$this->reservations->removeElement($reservations);
}
/**
* Get reservations
*
* #return \Doctrine\Common\Collections\Collection
*/
public function getReservations()
{
return $this->reservations;
}
/**
* Set inviteTemporaire
*
* #param boolean $inviteTemporaire
*
* #return InvitesGroupe
*/
public function setInviteTemporaire($inviteTemporaire)
{
$this->inviteTemporaire = $inviteTemporaire;
return $this;
}
/**
* Get inviteTemporaire
*
* #return boolean
*/
public function getInviteTemporaire()
{
return $this->inviteTemporaire;
}
/**
* Set wine
*
* #param boolean $wine
*
* #return InvitesGroupe
*/
public function setWine($wine)
{
$this->wine = $wine;
return $this;
}
/**
* Get wine
*
* #return boolean
*/
public function getWine()
{
return $this->wine;
}
/**
* Set coffee
*
* #param boolean $coffee
*
* #return InvitesGroupe
*/
public function setCoffee($coffee)
{
$this->coffee = $coffee;
return $this;
}
/**
* Get coffee
*
* #return boolean
*/
public function getCoffee()
{
return $this->coffee;
}
/**
* Set idUser
*
* #param \Ipb\AppBundle\Entity\Users $idUser
*
* #return InvitesGroupe
*/
public function setIdUser(\Ipb\AppBundle\Entity\Users $idUser = null)
{
$this->idUser = $idUser;
return $this;
}
/**
* Get idUser
*
* #return \Ipb\AppBundle\Entity\Users
*/
public function getIdUser()
{
return $this->idUser;
}
}
and the Reservations entity :
<?php
namespace Ipb\AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Reservations
*
* #ORM\Table(name="reservations", indexes={#ORM\Index(name="FK_reservations_id_invite", columns={"id_invite"}), #ORM\Index(name="FK_reservations_id_service", columns={"id_service"}), #ORM\Index(name="FK_reservations_id_restaurant", columns={"id_restaurant"}), #ORM\Index(name="FK_reservations_id_groupe_personnel", columns={"id_groupe_personnel"}), #ORM\Index(name="FK_reservations_id_classe", columns={"id_classe"}), #ORM\Index(name="FK_reservations_id_groupe", columns={"id_groupe"}), #ORM\Index(name="key_date_resa", columns={"date"})})
* #ORM\HasLifecycleCallbacks
* #ORM\Entity(repositoryClass="Ipb\AppBundle\EntityRepository\ReservationsRepository")
*/
class Reservations
{
/**
* #var integer
*
* #ORM\Column(name="id_reservation", type="integer", precision=0, scale=0, nullable=false, unique=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $idReservation;
/**
* #var \DateTime
*
* #ORM\Column(name="date", type="date", precision=0, scale=0, nullable=true, unique=false)
*/
private $date;
/**
* #var integer
*
* #ORM\Column(name="nb_place", type="integer", precision=0, scale=0, nullable=true, unique=false)
*/
private $nbPlace;
/**
* #var float
*
* #ORM\Column(name="cout_total", type="float", precision=10, scale=0, nullable=true, unique=false)
*/
private $coutTotal;
/**
* #var boolean
*
* #ORM\Column(name="repas_compris", type="boolean", precision=0, scale=0, nullable=true, unique=false)
*/
private $repasCompris;
/**
* #var \Ipb\AppBundle\Entity\GroupesPersonnels
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\GroupesPersonnels")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_groupe_personnel", referencedColumnName="id_groupe_personnel", nullable=true)
* })
*/
private $idGroupePersonnel;
/**
* #var integer
*
* #ORM\Column(name="incertain", type="integer", precision=0, scale=0, nullable=true, unique=false)
*/
private $incertain;
/**
* #var \Ipb\AppBundle\Entity\Classes
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\Classes")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_classe", referencedColumnName="id_classe", nullable=true)
* })
*/
private $idClasse;
/**
* #var \Ipb\AppBundle\Entity\Groupes
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\Groupes")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_groupe", referencedColumnName="id_groupe", nullable=true)
* })
*/
private $idGroupe;
/**
* #var \Ipb\AppBundle\Entity\InvitesGroupe
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\InvitesGroupe")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_invite", referencedColumnName="id_invite", nullable=true)
* })
*/
private $idInvite;
/**
* #var \Ipb\AppBundle\Entity\Restaurants
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\Restaurants")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_restaurant", referencedColumnName="id_restaurant", nullable=true)
* })
*/
private $idRestaurant;
/**
* #var \Ipb\AppBundle\Entity\Services
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\Services")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_service", referencedColumnName="id_service", nullable=true)
* })
*/
private $idService;
/**
*
* #ORM\ManyToOne(targetEntity="Ipb\AppBundle\Entity\InvitesGroupe", inversedBy="reservations", cascade={"persist"})
* #ORM\JoinColumn(name="id_invite", referencedColumnName="id_invite", onDelete="CASCADE")
*/
private $invitesGroupe;
/**
* Get idReservation
*
* #return integer
*/
public function getIdReservation()
{
return $this->idReservation;
}
/**
* Set date
*
* #param \DateTime $date
* #return Reservations
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Get date
*
* #return \DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* Set nbPlace
*
* #param integer $nbPlace
* #return Reservations
*/
public function setNbPlace($nbPlace)
{
$this->nbPlace = $nbPlace;
return $this;
}
/**
* Get nbPlace
*
* #return integer
*/
public function getNbPlace()
{
return $this->nbPlace;
}
/**
* Set coutTotal
*
* #param float $coutTotal
* #return Reservations
*/
public function setCoutTotal($coutTotal)
{
$this->coutTotal = $coutTotal;
return $this;
}
/**
* Get coutTotal
*
* #return float
*/
public function getCoutTotal()
{
return $this->coutTotal;
}
/**
* Set repasCompris
*
* #param boolean $repasCompris
* #return Reservations
*/
public function setRepasCompris($repasCompris)
{
$this->repasCompris = $repasCompris;
return $this;
}
/**
* Get repasCompris
*
* #return boolean
*/
public function getRepasCompris()
{
return $this->repasCompris;
}
/**
* Set idGroupePersonnel
*
* #param integer $idGroupePersonnel
* #return Reservations
*/
public function setIdGroupePersonnel($idGroupePersonnel)
{
$this->idGroupePersonnel = $idGroupePersonnel;
return $this;
}
/**
* Get idGroupePersonnel
*
* #return integer
*/
public function getIdGroupePersonnel()
{
return $this->idGroupePersonnel;
}
/**
* Set incertain
*
* #param integer $incertain
* #return Reservations
*/
public function setIncertain($incertain)
{
$this->incertain = $incertain;
return $this;
}
/**
* Get incertain
*
* #return integer
*/
public function getIncertain()
{
return $this->incertain;
}
/**
* Set idClasse
*
* #param \Ipb\AppBundle\Entity\Classes $idClasse
* #return Reservations
*/
public function setIdClasse(\Ipb\AppBundle\Entity\Classes $idClasse = null)
{
$this->idClasse = $idClasse;
return $this;
}
/**
* Get idClasse
*
* #return \Ipb\AppBundle\Entity\Classes
*/
public function getIdClasse()
{
return $this->idClasse;
}
/**
* Set idGroupe
*
* #param \Ipb\AppBundle\Entity\Groupes $idGroupe
* #return Reservations
*/
public function setIdGroupe(\Ipb\AppBundle\Entity\Groupes $idGroupe = null)
{
$this->idGroupe = $idGroupe;
return $this;
}
/**
* Get idGroupe
*
* #return \Ipb\AppBundle\Entity\Groupes
*/
public function getIdGroupe()
{
return $this->idGroupe;
}
/**
* Set idInvite
*
* #param \Ipb\AppBundle\Entity\InvitesGroupe $idInvite
* #return Reservations
*/
public function setIdInvite(\Ipb\AppBundle\Entity\InvitesGroupe $idInvite = null)
{
$this->idInvite = $idInvite;
return $this;
}
/**
* Get idInvite
*
* #return \Ipb\AppBundle\Entity\InvitesGroupe
*/
public function getIdInvite()
{
return $this->idInvite;
}
/**
* Set idRestaurant
*
* #param \Ipb\AppBundle\Entity\Restaurants $idRestaurant
* #return Reservations
*/
public function setIdRestaurant(\Ipb\AppBundle\Entity\Restaurants $idRestaurant = null)
{
$this->idRestaurant = $idRestaurant;
return $this;
}
/**
* Get idRestaurant
*
* #return \Ipb\AppBundle\Entity\Restaurants
*/
public function getIdRestaurant()
{
return $this->idRestaurant;
}
/**
* Set idService
*
* #param \Ipb\AppBundle\Entity\Services $idService
* #return Reservations
*/
public function setIdService(\Ipb\AppBundle\Entity\Services $idService = null)
{
$this->idService = $idService;
return $this;
}
/**
* Get idService
*
* #return \Ipb\AppBundle\Entity\Services
*/
public function getIdService()
{
return $this->idService;
}
/**
* Set invitesGroupe
*
* #param \Ipb\AppBundle\Entity\InvitesGroupe $invitesGroupe
* #return Reservations
*/
public function setInvitesGroupes(\Ipb\AppBundle\Entity\InvitesGroupe $invitesGroupe = null)
{
$this->invitesGroupe = $invitesGroupe;
return $this;
}
/**
* Get invitesGroupes
*
* #return \Ipb\AppBundle\Entity\InvitesGroupes
*/
public function getInvitesGroupe()
{
return $this->invitesGroupe;
}
}
the controller :
/**
* Lists all InvitesGroupe entities.
*
* #Route("/", name="invitesgroupe_index")
* #Method("GET")
*/
public function indexAction(Request $request)
{
$em = $this->getDoctrine()->getManager();
$day = $request->get('day');
$resto = $request->get('resto');
$user = !$this->get('security.authorization_checker')->isGranted('ROLE_SUPERVISEUR') ? "AND ig.idUser = '".$this->get('security.context')->getToken()->getUser()->getIdUser()."'" : "";
if($day){
$day = \DateTime::createFromFormat('d/m/Y', $day);
$dql = "SELECT ig FROM IpbAppBundle:InvitesGroupe ig
LEFT JOIN IpbAppBundle:Reservations r WITH r.idInvite = ig.idInvite
WHERE ig.inviteVisible = 1
AND ig.inviteTemporaire IS NULL
AND r.date = '".$day->format('Y-m-d')."'
".$user."
ORDER BY ig.idInvite DESC";
}else if($resto && $day){
$day = \DateTime::createFromFormat('d/m/Y', $day);
$dql = "SELECT ig FROM IpbAppBundle:InvitesGroupe ig
LEFT JOIN IpbAppBundle:Reservations r WITH r.idInvite = ig.idInvite
WHERE ig.inviteVisible = 1 AND ig.inviteTemporaire IS NULL
AND r.idRestaurant = ".$resto."
AND r.date = '".$day->format('Y-m-d')."'
".$user."
ORDER BY ig.idInvite DESC";
}else{
$dql = "SELECT ig FROM IpbAppBundle:InvitesGroupe ig
LEFT JOIN IpbAppBundle:Reservations r WITH r.idInvite = ig.idInvite
WHERE ig.inviteVisible = 1 AND ig.inviteTemporaire IS NULL
AND r.date >= CURRENT_TIMESTAMP()
".$user."
ORDER BY ig.idInvite DESC";
}
$query = $em->createQuery($dql);
$paginator = $this->get('knp_paginator');
$pagination = $paginator->paginate(
$query, /* query NOT result */
$request->query->getInt('page', 1)/*page number*/,
10/*limit per page*/
);
$deleteForms = array();
if(null !== $request->get('print')){
return $pagination;
}
foreach ($pagination as $page) {
$deleteForms[$page->getIdInvite()] = $this->createDeleteForm($page)->createView();
}
if($day){
$restoTest = array();
$restos = array();
foreach ($pagination as $invite) {
if(!in_array($invite->getIdService()->getIdRestaurant()->getIdRestaurant(), $restoTest)){
$obj = new \stdClass();
$obj->id = $invite->getIdService()->getIdRestaurant()->getIdRestaurant();
$obj->nom = $invite->getIdService()->getIdRestaurant()->getNomRestaurant();
$restos[] = $obj;
$restoTest[] = $invite->getIdService()->getIdRestaurant()->getIdRestaurant();
}
}
}
return $this->render('invitesgroupe/index.html.twig', array(
'invitesGroupes' => $pagination,
'delete_forms' => $deleteForms,
'day' => $day ? $day : null,
'restos' => isset($restos) ? json_encode($restos) : null
));
}

'Error: Invalid PathExpression. Must be a StateFieldPathExpression' Error in doctrine

I'm trying to join two tables and take a column value with doctrine query builder.
This is my code
public function getLatestProduct($amount) {
$em = $this->container->get('doctrine.orm.entity_manager');
$qb = $em->createQueryBuilder();
$qb->select('p.id, p.category, p.productTitle, p.price, p.description, pi.imgUrl')
->from('EagleShopBundle:Products', 'p')
->leftJoin('EagleShopBundle:ProuctImage', 'pi', \Doctrine\ORM\Query\Expr\Join::WITH, 'pi.productId = p.id')
->orderBy('p.id', 'DESC')
->groupBy('p.id')
->setMaxResults($amount);
return $qb->getQuery()->getResult();
}
This is where I call it
public function indexAction() {
$latest = $this->getLatestProduct(8);
$isfeatured = $this->getfeaturedProduct(8);
return $this->render("EagleShopBundle:global:home.html.twig", array(
'image_path' => '/bundles/eagleshop/images/',
'latest_products' => $latest,
'isfeatured' => $isfeatured
));
}
But when I try to call this method I'm having this issue,
[Semantical Error] line 0, col 15 near 'category, p.productTitle,':
Error: Invalid PathExpression. Must be a StateFieldPathExpression.
I think this code is related to the issue,
$qb->select('p.id, p.category, p.productTitle, p.price, p.description,
pi.imgUrl')
This is my Product entity
<?php
namespace Eagle\ShopBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Products
*
* #ORM\Table(name="products", indexes={#ORM\Index(name="category", columns={"category"})})
* #ORM\Entity
*/
class Products
{
/**
* #var string
*
* #ORM\Column(name="product_title", type="string", length=400, nullable=false)
*/
private $productTitle;
/**
* #var string
*
* #ORM\Column(name="description", type="string", length=400, nullable=false)
*/
private $description;
/**
* #var float
*
* #ORM\Column(name="price", type="float", precision=10, scale=0, nullable=false)
*/
private $price;
/**
* #var integer
*
* #ORM\Column(name="store_id", type="integer", nullable=false)
*/
private $storeId;
/**
* #var integer
*
* #ORM\Column(name="status", type="integer", nullable=false)
*/
private $status;
/**
* #var integer
*
* #ORM\Column(name="stock", type="integer", nullable=false)
*/
private $stock;
/**
* #var integer
*
* #ORM\Column(name="isfeatured", type="integer", nullable=false)
*/
private $isfeatured;
/**
* #var \DateTime
*
* #ORM\Column(name="created_at", type="datetime", nullable=false)
*/
private $createdAt;
/**
* #var \DateTime
*
* #ORM\Column(name="updated_at", type="datetime", nullable=false)
*/
private $updatedAt;
/**
* #var integer
*
* #ORM\Column(name="online", type="integer", nullable=false)
*/
private $online;
/**
* #var integer
*
* #ORM\Column(name="id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* #var \Eagle\ShopBundle\Entity\ProductCategory
*
* #ORM\ManyToOne(targetEntity="Eagle\ShopBundle\Entity\ProductCategory")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="category", referencedColumnName="id")
* })
*/
private $category;
/**
* Set productTitle
*
* #param string $productTitle
* #return Products
*/
public function setProductTitle($productTitle)
{
$this->productTitle = $productTitle;
return $this;
}
/**
* Get productTitle
*
* #return string
*/
public function getProductTitle()
{
return $this->productTitle;
}
/**
* Set description
*
* #param string $description
* #return Products
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* #return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set price
*
* #param float $price
* #return Products
*/
public function setPrice($price)
{
$this->price = $price;
return $this;
}
/**
* Get price
*
* #return float
*/
public function getPrice()
{
return $this->price;
}
/**
* Set storeId
*
* #param integer $storeId
* #return Products
*/
public function setStoreId($storeId)
{
$this->storeId = $storeId;
return $this;
}
/**
* Get storeId
*
* #return integer
*/
public function getStoreId()
{
return $this->storeId;
}
/**
* Set status
*
* #param integer $status
* #return Products
*/
public function setStatus($status)
{
$this->status = $status;
return $this;
}
/**
* Get status
*
* #return integer
*/
public function getStatus()
{
return $this->status;
}
/**
* Set stock
*
* #param integer $stock
* #return Products
*/
public function setStock($stock)
{
$this->stock = $stock;
return $this;
}
/**
* Get stock
*
* #return integer
*/
public function getStock()
{
return $this->stock;
}
/**
* Set isfeatured
*
* #param integer $isfeatured
* #return Products
*/
public function setIsfeatured($isfeatured)
{
$this->isfeatured = $isfeatured;
return $this;
}
/**
* Get isfeatured
*
* #return integer
*/
public function getIsfeatured()
{
return $this->isfeatured;
}
/**
* Set createdAt
*
* #param \DateTime $createdAt
* #return Products
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* #return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* #param \DateTime $updatedAt
* #return Products
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* #return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set online
*
* #param integer $online
* #return Products
*/
public function setOnline($online)
{
$this->online = $online;
return $this;
}
/**
* Get online
*
* #return integer
*/
public function getOnline()
{
return $this->online;
}
/**
* Get id
*
* #return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set category
*
* #param \Eagle\ShopBundle\Entity\ProductCategory $category
* #return Products
*/
public function setCategory(\Eagle\ShopBundle\Entity\ProductCategory $category = null)
{
$this->category = $category;
return $this;
}
/**
* Get category
*
* #return \Eagle\ShopBundle\Entity\ProductCategory
*/
public function getCategory()
{
return $this->category;
}
}

Symfony 2 doctrine left join

I have query
$em = $this->getDoctrine()->getManager();
$query = $em->createQueryBuilder();
$query = $em->createQueryBuilder()
->select('com', 'cit')
->from('CatalogWebBundle:ComCompany', 'com')
->leftJoin('com.cmpCity', 'cit')
->getQuery()
->setMaxResults(1);
$info = $query->getResult();
work fine, but I dont know how to get result from JOINED TABLE. I try use get method from JOINED table ENTITIES, but it not work ?
Maybe I need to ad something to ENTITIES ?
class ComCity
{
/**
* #var integer
*
* #ORM\Column(name="cit_id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $citId;
/**
* #var string
*
* #ORM\Column(name="cit_name", type="string", length=255, nullable=true)
*/
private $citName;
/**
* Get citId
*
* #return integer
*/
public function getCitId()
{
return $this->citId;
}
/**
* Set citName
*
* #param string $citName
* #return ComCity
*/
public function setCitName($citName)
{
$this->citName = $citName;
return $this;
}
/**
* Get citName
*
* #return string
*/
public function getCitName()
{
return $this->citName;
}
}
namespace Catalog\WebBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
class ComCompany
{
/**
* #var integer
*
* #ORM\Column(name="cmp_id", type="integer")
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $cmpId;
/**
* #var string
*
* #ORM\Column(name="cmp_name", type="string", length=255, nullable=true)
*/
private $cmpName;
/**
* #var integer
*
* #ORM\Column(name="cmp_code", type="bigint", nullable=true)
*/
private $cmpCode;
/**
* #var string
*
* #ORM\Column(name="cmp_vat", type="string", length=255, nullable=true)
*/
private $cmpVat;
/**
* #var integer
*
* #ORM\Column(name="cmp_emp", type="integer", nullable=true)
*/
private $cmpEmp;
/**
* #var string
*
* #ORM\Column(name="cmp_return", type="string", length=255, nullable=true)
*/
private $cmpReturn;
/**
* #var string
*
* #ORM\Column(name="cmp_return_from", type="string", length=255, nullable=true)
*/
private $cmpReturnFrom;
/**
* #var string
*
* #ORM\Column(name="cmp_return_till", type="string", length=255, nullable=true)
*/
private $cmpReturnTill;
/**
* #var string
*
* #ORM\Column(name="cmp_address", type="string", length=255, nullable=true)
*/
private $cmpAddress;
/**
* #var integer
*
* #ORM\Column(name="cmp_phone", type="bigint", nullable=true)
*/
private $cmpPhone;
/**
* #var string
*
* #ORM\Column(name="cmp_email", type="string", length=255, nullable=true)
*/
private $cmpEmail;
/**
* #var string
*
* #ORM\Column(name="cmp_site", type="string", length=255, nullable=true)
*/
private $cmpSite;
/**
* #var string
*
* #ORM\Column(name="cmp_ceo", type="string", length=255, nullable=true)
*/
private $cmpCeo;
/**
* #var string
*
* #ORM\Column(name="cmp_register", type="string", length=255, nullable=true)
*/
private $cmpRegister;
/**
* #var string
*
* #ORM\Column(name="cmp_url", type="string", length=255, nullable=false)
*/
private $cmpUrl;
/**
* #var \Catalog\WebBundle\Entity\ComCategory
*
* #ORM\ManyToOne(targetEntity="Catalog\WebBundle\Entity\ComCategory")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="cmp_category", referencedColumnName="cat_id")
* })
*/
private $cmpCategory;
/**
* #var \Catalog\WebBundle\Entity\ComCity
*
* #ORM\ManyToOne(targetEntity="Catalog\WebBundle\Entity\ComCity")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="cmp_city", referencedColumnName="cit_id")
* })
*/
private $cmpCity;
/**
* Get cmpId
*
* #return integer
*/
public function getCmpId()
{
return $this->cmpId;
}
/**
* Set cmpName
*
* #param string $cmpName
* #return ComCompany
*/
public function setCmpName($cmpName)
{
$this->cmpName = $cmpName;
return $this;
}
/**
* Get cmpName
*
* #return string
*/
public function getCmpName()
{
return $this->cmpName;
}
/**
* Set cmpCode
*
* #param integer $cmpCode
* #return ComCompany
*/
public function setCmpCode($cmpCode)
{
$this->cmpCode = $cmpCode;
return $this;
}
/**
* Get cmpCode
*
* #return integer
*/
public function getCmpCode()
{
return $this->cmpCode;
}
/**
* Set cmpVat
*
* #param string $cmpVat
* #return ComCompany
*/
public function setCmpVat($cmpVat)
{
$this->cmpVat = $cmpVat;
return $this;
}
/**
* Get cmpVat
*
* #return string
*/
public function getCmpVat()
{
return $this->cmpVat;
}
/**
* Set cmpEmp
*
* #param integer $cmpEmp
* #return ComCompany
*/
public function setCmpEmp($cmpEmp)
{
$this->cmpEmp = $cmpEmp;
return $this;
}
/**
* Get cmpEmp
*
* #return integer
*/
public function getCmpEmp()
{
return $this->cmpEmp;
}
/**
* Set cmpReturn
*
* #param string $cmpReturn
* #return ComCompany
*/
public function setCmpReturn($cmpReturn)
{
$this->cmpReturn = $cmpReturn;
return $this;
}
/**
* Get cmpReturn
*
* #return string
*/
public function getCmpReturn()
{
return $this->cmpReturn;
}
/**
* Set cmpReturnFrom
*
* #param string $cmpReturnFrom
* #return ComCompany
*/
public function setCmpReturnFrom($cmpReturnFrom)
{
$this->cmpReturnFrom = $cmpReturnFrom;
return $this;
}
/**
* Get cmpReturnFrom
*
* #return string
*/
public function getCmpReturnFrom()
{
return $this->cmpReturnFrom;
}
/**
* Set cmpReturnTill
*
* #param string $cmpReturnTill
* #return ComCompany
*/
public function setCmpReturnTill($cmpReturnTill)
{
$this->cmpReturnTill = $cmpReturnTill;
return $this;
}
/**
* Get cmpReturnTill
*
* #return string
*/
public function getCmpReturnTill()
{
return $this->cmpReturnTill;
}
/**
* Set cmpAddress
*
* #param string $cmpAddress
* #return ComCompany
*/
public function setCmpAddress($cmpAddress)
{
$this->cmpAddress = $cmpAddress;
return $this;
}
/**
* Get cmpAddress
*
* #return string
*/
public function getCmpAddress()
{
return $this->cmpAddress;
}
/**
* Set cmpPhone
*
* #param integer $cmpPhone
* #return ComCompany
*/
public function setCmpPhone($cmpPhone)
{
$this->cmpPhone = $cmpPhone;
return $this;
}
/**
* Get cmpPhone
*
* #return integer
*/
public function getCmpPhone()
{
return $this->cmpPhone;
}
/**
* Set cmpEmail
*
* #param string $cmpEmail
* #return ComCompany
*/
public function setCmpEmail($cmpEmail)
{
$this->cmpEmail = $cmpEmail;
return $this;
}
/**
* Get cmpEmail
*
* #return string
*/
public function getCmpEmail()
{
return $this->cmpEmail;
}
/**
* Set cmpSite
*
* #param string $cmpSite
* #return ComCompany
*/
public function setCmpSite($cmpSite)
{
$this->cmpSite = $cmpSite;
return $this;
}
/**
* Get cmpSite
*
* #return string
*/
public function getCmpSite()
{
return $this->cmpSite;
}
/**
* Set cmpCeo
*
* #param string $cmpCeo
* #return ComCompany
*/
public function setCmpCeo($cmpCeo)
{
$this->cmpCeo = $cmpCeo;
return $this;
}
/**
* Get cmpCeo
*
* #return string
*/
public function getCmpCeo()
{
return $this->cmpCeo;
}
/**
* Set cmpRegister
*
* #param string $cmpRegister
* #return ComCompany
*/
public function setCmpRegister($cmpRegister)
{
$this->cmpRegister = $cmpRegister;
return $this;
}
/**
* Get cmpRegister
*
* #return string
*/
public function getCmpRegister()
{
return $this->cmpRegister;
}
/**
* Set cmpUrl
*
* #param string $cmpUrl
* #return ComCompany
*/
public function setCmpUrl($cmpUrl)
{
$this->cmpUrl = $cmpUrl;
return $this;
}
/**
* Get cmpUrl
*
* #return string
*/
public function getCmpUrl()
{
return $this->cmpUrl;
}
/**
* Set cmpCategory
*
* #param \Catalog\WebBundle\Entity\ComCategory $cmpCategory
* #return ComCompany
*/
public function setCmpCategory(\Catalog\WebBundle\Entity\ComCategory $cmpCategory = null)
{
$this->cmpCategory = $cmpCategory;
return $this;
}
/**
* Get cmpCategory
*
* #return \Catalog\WebBundle\Entity\ComCategory
*/
public function getCmpCategory()
{
return $this->cmpCategory;
}
/**
* Set cmpCity
*
* #param \Catalog\WebBundle\Entity\ComCity $cmpCity
* #return ComCompany
*/
public function setCmpCity(\Catalog\WebBundle\Entity\ComCity $cmpCity = null)
{
$this->cmpCity = $cmpCity;
return $this;
}
/**
* Get cmpCity
*
* #return \Catalog\WebBundle\Entity\ComCity
*/
public function getCmpCity()
{
return $this->cmpCity;
}
}
getResult() returns the entire set of results as an iterable array collection, not a single result. Thus, when you are using setMaxResults(1), it is wise to fetch that single result using getSingleResult():
$info = $query->getSingleResult();
If no results are returned, $info will be null. Otherwise you will be able to access the cmpCity property using:
$cmpCity = $info->getCmpCity();
Again, $cmpCity will be null if there is no cmpCity associated with the ComCompany object. If you want to get the first ComCompany object that does have an associated cmpCity, use innerJoin instead of leftJoin:
$query = $em->createQueryBuilder()
->select('com', 'cit')
->from('CatalogWebBundle:ComCompany', 'com')
->innerJoin('com.cmpCity', 'cit')
->getQuery()
->setMaxResults(1);
$info = $query->getSingleResult();
$cmpCity = $info->getCmpCity();
This might be related to the issue when you combine leftJoin and setMaxResults.
There is already answers on how you should do your query : https://stackoverflow.com/a/14886847/3726645

How to validate Entity form field using yml in Symfony2?

I got following error message when I tried to validate entity type form filed using validation.yml file
Catchable Fatal Error: Argument 1 passed to Frontend\EntityBundle\Entity\StudentRegistration::setIdState() must be an instance of Frontend\EntityBundle\Entity\MasterState, null given, called in C:\wamp\www\careerguide\vendor\symfony\src\Symfony\Component\Form\Util\PropertyPath.php on line 347 and defined in C:\wamp\www\careerguide\src\Frontend\EntityBundle\Entity\StudentRegistration.php line 1099
in form,
->add('idState', 'entity', array('class' => 'Frontend\EntityBundle\Entity\MasterState', 'property' => 'stateName', 'empty_value' => 'Select State', 'label' => 'State :', 'attr' => array('class' => 'width275'), 'required' => false))
In entity,
<?php
namespace Frontend\EntityBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Frontend\EntityBundle\Entity\StudentRegistration
*
* #ORM\Table(name="student_registration")
* #ORM\Entity
/
class StudentRegistration
{
/*
* #var integer $id
*
* #ORM\Column(name="id", type="integer", nullable=false)
* #ORM\Id
* #ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* #var string $idStudentRegistration
*
* #ORM\Column(name="id_student_registration", type="string", length=128, nullable=false)
*/
private $idStudentRegistration;
/**
* #var integer $idAttempt
*
* #ORM\Column(name="id_attempt", type="integer", nullable=true)
*/
private $idAttempt;
/**
* #var string $firstName
*
* #ORM\Column(name="first_name", type="string", length=128, nullable=false)
*/
private $firstName;
/**
* #var string $lastName
*
* #ORM\Column(name="last_name", type="string", length=128, nullable=true)
*/
private $lastName;
/**
* #var datetime $dateOfBirth
*
* #ORM\Column(name="date_of_birth", type="datetime", nullable=true)
*/
private $dateOfBirth;
/**
* #var string $gender
*
* #ORM\Column(name="gender", type="string", length=16, nullable=true)
*/
private $gender;
/**
* #var string $email
*
* #ORM\Column(name="email", type="string", length=128, nullable=true)
*/
private $email;
/**
* #var string $password
*
* #ORM\Column(name="password", type="string", length=128, nullable=true)
*/
private $password;
/**
* #var string $mobileNumber
*
* #ORM\Column(name="mobile_number", type="string", length=16, nullable=true)
*/
private $mobileNumber;
/**
* #var string $stdCode
*
* #ORM\Column(name="std_code", type="string", length=16, nullable=true)
*/
private $stdCode;
/**
* #var integer $landlineNumber
*
* #ORM\Column(name="landline_number", type="integer", nullable=true)
*/
private $landlineNumber;
/**
* #var text $address
*
* #ORM\Column(name="address", type="text", nullable=true)
*/
private $address;
/**
* #var integer $pincode
*
* #ORM\Column(name="pincode", type="integer", nullable=true)
*/
private $pincode;
/**
* #var string $disabilityPercentage
*
* #ORM\Column(name="disability_percentage", type="string", length=16, nullable=true)
*/
private $disabilityPercentage;
/**
* #var string $schoolName
*
* #ORM\Column(name="school_name", type="string", length=256, nullable=true)
*/
private $schoolName;
/**
* #var string $collegeName
*
* #ORM\Column(name="college_name", type="string", length=256, nullable=true)
*/
private $collegeName;
/**
* #var string $qualificationStatus
*
* #ORM\Column(name="qualification_status", type="string", length=128, nullable=true)
*/
private $qualificationStatus;
/**
* #var string $courseDuration
*
* #ORM\Column(name="course_duration", type="string", length=16, nullable=true)
*/
private $courseDuration;
/**
* #var string $workExposure
*
* #ORM\Column(name="work_exposure", type="string", length=16, nullable=true)
*/
private $workExposure;
/**
* #var string $userStudyDuration
*
* #ORM\Column(name="user_study_duration", type="string", length=16, nullable=true)
*/
private $userStudyDuration;
/**
* #var text $achievements
*
* #ORM\Column(name="achievements", type="text", nullable=true)
*/
private $achievements;
/**
* #var datetime $createdAt
*
* #ORM\Column(name="created_at", type="datetime", nullable=true)
*/
private $createdAt;
/**
* #var datetime $updatedAt
*
* #ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private $updatedAt;
/**
* #var integer $version
*
* #ORM\Column(name="version", type="integer", nullable=true)
*/
private $version;
/**
* #var MasterCity
*
* #ORM\ManyToOne(targetEntity="MasterCity")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_city", referencedColumnName="id")
* })
*/
private $idCity;
/**
* #var MasterStreamgroup
*
* #ORM\ManyToOne(targetEntity="MasterStreamgroup")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_streamgroup", referencedColumnName="id")
* })
*/
private $idStreamgroup;
/**
* #var MasterQualification
*
* #ORM\ManyToOne(targetEntity="MasterQualification")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_qualification_father", referencedColumnName="id")
* })
*/
private $idQualificationFather;
/**
* #var MasterOccupation
*
* #ORM\ManyToOne(targetEntity="MasterOccupation")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_occupation_father", referencedColumnName="id")
* })
*/
private $idOccupationFather;
/**
* #var MasterQualification
*
* #ORM\ManyToOne(targetEntity="MasterQualification")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_qualification_mother", referencedColumnName="id")
* })
*/
private $idQualificationMother;
/**
* #var MasterOccupation
*
* #ORM\ManyToOne(targetEntity="MasterOccupation")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_occupation_mother", referencedColumnName="id")
* })
*/
private $idOccupationMother;
/**
* #var MasterCity
*
* #ORM\ManyToOne(targetEntity="MasterCity")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_preferred_city1", referencedColumnName="id")
* })
*/
private $idPreferredCity1;
/**
* #var MasterCity
*
* #ORM\ManyToOne(targetEntity="MasterCity")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_preferred_city2", referencedColumnName="id")
* })
*/
private $idPreferredCity2;
/**
* #var MasterCity
*
* #ORM\ManyToOne(targetEntity="MasterCity")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_preferred_city3", referencedColumnName="id")
* })
*/
private $idPreferredCity3;
/**
* #var MasterBudget
*
* #ORM\ManyToOne(targetEntity="MasterBudget")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_budget", referencedColumnName="id")
* })
*/
private $idBudget;
/**
* #var MasterMode
*
* #ORM\ManyToOne(targetEntity="MasterMode")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_mode", referencedColumnName="id")
* })
*/
private $idMode;
/**
* #var MasterState
*
* #ORM\ManyToOne(targetEntity="MasterState")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_state", referencedColumnName="id")
* })
*/
private $idState;
/**
* #var MasterCountry
*
* #ORM\ManyToOne(targetEntity="MasterCountry")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_country", referencedColumnName="id")
* })
*/
private $idCountry;
/**
* #var MasterHealth
*
* #ORM\ManyToOne(targetEntity="MasterHealth")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_health", referencedColumnName="id")
* })
*/
private $idHealth;
/**
* #var MasterQualification
*
* #ORM\ManyToOne(targetEntity="MasterQualification")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_qualification", referencedColumnName="id")
* })
*/
private $idQualification;
/**
* #var MasterMedium
*
* #ORM\ManyToOne(targetEntity="MasterMedium")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_medium", referencedColumnName="id")
* })
*/
private $idMedium;
/**
* #var MasterBoard
*
* #ORM\ManyToOne(targetEntity="MasterBoard")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_board", referencedColumnName="id")
* })
*/
private $idBoard;
/**
* #var MasterUniversity
*
* #ORM\ManyToOne(targetEntity="MasterUniversity")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_university", referencedColumnName="id")
* })
*/
private $idUniversity;
/**
* #var MasterStream
*
* #ORM\ManyToOne(targetEntity="MasterStream")
* #ORM\JoinColumns({
* #ORM\JoinColumn(name="id_stream", referencedColumnName="id")
* })
*/
private $idStream;
/**
* Get id
*
* #return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set idStudentRegistration
*
* #param string $idStudentRegistration
*/
public function setIdStudentRegistration($idStudentRegistration)
{
$this->idStudentRegistration = $idStudentRegistration;
}
/**
* Get idStudentRegistration
*
* #return string
*/
public function getIdStudentRegistration()
{
return $this->idStudentRegistration;
}
/**
* Set idAttempt
*
* #param integer $idAttempt
*/
public function setIdAttempt($idAttempt)
{
$this->idAttempt = $idAttempt;
}
/**
* Get idAttempt
*
* #return integer
*/
public function getIdAttempt()
{
return $this->idAttempt;
}
/**
* Set firstName
*
* #param string $firstName
*/
public function setFirstName($firstName)
{
$this->firstName = $firstName;
}
/**
* Get firstName
*
* #return string
*/
public function getFirstName()
{
return $this->firstName;
}
/**
* Set lastName
*
* #param string $lastName
*/
public function setLastName($lastName)
{
$this->lastName = $lastName;
}
/**
* Get lastName
*
* #return string
*/
public function getLastName()
{
return $this->lastName;
}
/**
* Set dateOfBirth
*
* #param datetime $dateOfBirth
*/
public function setDateOfBirth($dateOfBirth)
{
$this->dateOfBirth = $dateOfBirth;
}
/**
* Get dateOfBirth
*
* #return datetime
*/
public function getDateOfBirth()
{
return $this->dateOfBirth;
}
/**
* Set gender
*
* #param string $gender
*/
public function setGender($gender)
{
$this->gender = $gender;
}
/**
* Get gender
*
* #return string
*/
public function getGender()
{
return $this->gender;
}
/**
* Set email
*
* #param string $email
*/
public function setEmail($email)
{
$this->email = $email;
}
/**
* Get email
*
* #return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set password
*
* #param string $password
*/
public function setPassword($password)
{
$this->password = $password;
}
/**
* Get password
*
* #return string
*/
public function getPassword()
{
return $this->password;
}
/**
* Set mobileNumber
*
* #param string $mobileNumber
*/
public function setMobileNumber($mobileNumber)
{
$this->mobileNumber = $mobileNumber;
}
/**
* Get mobileNumber
*
* #return string
*/
public function getMobileNumber()
{
return $this->mobileNumber;
}
/**
* Set stdCode
*
* #param string $stdCode
*/
public function setStdCode($stdCode)
{
$this->stdCode = $stdCode;
}
/**
* Get stdCode
*
* #return string
*/
public function getStdCode()
{
return $this->stdCode;
}
/**
* Set landlineNumber
*
* #param integer $landlineNumber
*/
public function setLandlineNumber($landlineNumber)
{
$this->landlineNumber = $landlineNumber;
}
/**
* Get landlineNumber
*
* #return integer
*/
public function getLandlineNumber()
{
return $this->landlineNumber;
}
/**
* Set address
*
* #param text $address
*/
public function setAddress($address)
{
$this->address = $address;
}
/**
* Get address
*
* #return text
*/
public function getAddress()
{
return $this->address;
}
/**
* Set pincode
*
* #param integer $pincode
*/
public function setPincode($pincode)
{
$this->pincode = $pincode;
}
/**
* Get pincode
*
* #return integer
*/
public function getPincode()
{
return $this->pincode;
}
/**
* Set disabilityPercentage
*
* #param string $disabilityPercentage
*/
public function setDisabilityPercentage($disabilityPercentage)
{
$this->disabilityPercentage = $disabilityPercentage;
}
/**
* Get disabilityPercentage
*
* #return string
*/
public function getDisabilityPercentage()
{
return $this->disabilityPercentage;
}
/**
* Set schoolName
*
* #param string $schoolName
*/
public function setSchoolName($schoolName)
{
$this->schoolName = $schoolName;
}
/**
* Get schoolName
*
* #return string
*/
public function getSchoolName()
{
return $this->schoolName;
}
/**
* Set collegeName
*
* #param string $collegeName
*/
public function setCollegeName($collegeName)
{
$this->collegeName = $collegeName;
}
/**
* Get collegeName
*
* #return string
*/
public function getCollegeName()
{
return $this->collegeName;
}
/**
* Set qualificationStatus
*
* #param string $qualificationStatus
*/
public function setQualificationStatus($qualificationStatus)
{
$this->qualificationStatus = $qualificationStatus;
}
/**
* Get qualificationStatus
*
* #return string
*/
public function getQualificationStatus()
{
return $this->qualificationStatus;
}
/**
* Set courseDuration
*
* #param string $courseDuration
*/
public function setCourseDuration($courseDuration)
{
$this->courseDuration = $courseDuration;
}
/**
* Get courseDuration
*
* #return string
*/
public function getCourseDuration()
{
return $this->courseDuration;
}
/**
* Set workExposure
*
* #param string $workExposure
*/
public function setWorkExposure($workExposure)
{
$this->workExposure = $workExposure;
}
/**
* Get workExposure
*
* #return string
*/
public function getWorkExposure()
{
return $this->workExposure;
}
/**
* Set userStudyDuration
*
* #param string $userStudyDuration
*/
public function setUserStudyDuration($userStudyDuration)
{
$this->userStudyDuration = $userStudyDuration;
}
/**
* Get userStudyDuration
*
* #return string
*/
public function getUserStudyDuration()
{
return $this->userStudyDuration;
}
/**
* Set achievements
*
* #param text $achievements
*/
public function setAchievements($achievements)
{
$this->achievements = $achievements;
}
/**
* Get achievements
*
* #return text
*/
public function getAchievements()
{
return $this->achievements;
}
/**
* Set createdAt
*
* #param datetime $createdAt
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
}
/**
* Get createdAt
*
* #return datetime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* #param datetime $updatedAt
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
}
/**
* Get updatedAt
*
* #return datetime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set version
*
* #param integer $version
*/
public function setVersion($version)
{
$this->version = $version;
}
/**
* Get version
*
* #return integer
*/
public function getVersion()
{
return $this->version;
}
/**
* Set idCity
*
* #param Frontend\EntityBundle\Entity\MasterCity $idCity
*/
public function setIdCity(\Frontend\EntityBundle\Entity\MasterCity $idCity)
{
$this->idCity = $idCity;
}
/**
* Get idCity
*
* #return Frontend\EntityBundle\Entity\MasterCity
*/
public function getIdCity()
{
return $this->idCity;
}
/**
* Set idStreamgroup
*
* #param Frontend\EntityBundle\Entity\MasterStreamgroup $idStreamgroup
*/
public function setIdStreamgroup(\Frontend\EntityBundle\Entity\MasterStreamgroup $idStreamgroup)
{
$this->idStreamgroup = $idStreamgroup;
}
/**
* Get idStreamgroup
*
* #return Frontend\EntityBundle\Entity\MasterStreamgroup
*/
public function getIdStreamgroup()
{
return $this->idStreamgroup;
}
/**
* Set idQualificationFather
*
* #param Frontend\EntityBundle\Entity\MasterQualification $idQualificationFather
*/
public function setIdQualificationFather(\Frontend\EntityBundle\Entity\MasterQualification $idQualificationFather)
{
$this->idQualificationFather = $idQualificationFather;
}
/**
* Get idQualificationFather
*
* #return Frontend\EntityBundle\Entity\MasterQualification
*/
public function getIdQualificationFather()
{
return $this->idQualificationFather;
}
/**
* Set idOccupationFather
*
* #param Frontend\EntityBundle\Entity\MasterOccupation $idOccupationFather
*/
public function setIdOccupationFather(\Frontend\EntityBundle\Entity\MasterOccupation $idOccupationFather)
{
$this->idOccupationFather = $idOccupationFather;
}
/**
* Get idOccupationFather
*
* #return Frontend\EntityBundle\Entity\MasterOccupation
*/
public function getIdOccupationFather()
{
return $this->idOccupationFather;
}
/**
* Set idQualificationMother
*
* #param Frontend\EntityBundle\Entity\MasterQualification $idQualificationMother
*/
public function setIdQualificationMother(\Frontend\EntityBundle\Entity\MasterQualification $idQualificationMother)
{
$this->idQualificationMother = $idQualificationMother;
}
/**
* Get idQualificationMother
*
* #return Frontend\EntityBundle\Entity\MasterQualification
*/
public function getIdQualificationMother()
{
return $this->idQualificationMother;
}
/**
* Set idOccupationMother
*
* #param Frontend\EntityBundle\Entity\MasterOccupation $idOccupationMother
*/
public function setIdOccupationMother(\Frontend\EntityBundle\Entity\MasterOccupation $idOccupationMother)
{
$this->idOccupationMother = $idOccupationMother;
}
/**
* Get idOccupationMother
*
* #return Frontend\EntityBundle\Entity\MasterOccupation
*/
public function getIdOccupationMother()
{
return $this->idOccupationMother;
}
/**
* Set idPreferredCity1
*
* #param Frontend\EntityBundle\Entity\MasterCity $idPreferredCity1
*/
public function setIdPreferredCity1(\Frontend\EntityBundle\Entity\MasterCity $idPreferredCity1)
{
$this->idPreferredCity1 = $idPreferredCity1;
}
/**
* Get idPreferredCity1
*
* #return Frontend\EntityBundle\Entity\MasterCity
*/
public function getIdPreferredCity1()
{
return $this->idPreferredCity1;
}
/**
* Set idPreferredCity2
*
* #param Frontend\EntityBundle\Entity\MasterCity $idPreferredCity2
*/
public function setIdPreferredCity2(\Frontend\EntityBundle\Entity\MasterCity $idPreferredCity2)
{
$this->idPreferredCity2 = $idPreferredCity2;
}
/**
* Get idPreferredCity2
*
* #return Frontend\EntityBundle\Entity\MasterCity
*/
public function getIdPreferredCity2()
{
return $this->idPreferredCity2;
}
/**
* Set idPreferredCity3
*
* #param Frontend\EntityBundle\Entity\MasterCity $idPreferredCity3
*/
public function setIdPreferredCity3(\Frontend\EntityBundle\Entity\MasterCity $idPreferredCity3)
{
$this->idPreferredCity3 = $idPreferredCity3;
}
/**
* Get idPreferredCity3
*
* #return Frontend\EntityBundle\Entity\MasterCity
*/
public function getIdPreferredCity3()
{
return $this->idPreferredCity3;
}
/**
* Set idBudget
*
* #param Frontend\EntityBundle\Entity\MasterBudget $idBudget
*/
public function setIdBudget(\Frontend\EntityBundle\Entity\MasterBudget $idBudget)
{
$this->idBudget = $idBudget;
}
/**
* Get idBudget
*
* #return Frontend\EntityBundle\Entity\MasterBudget
*/
public function getIdBudget()
{
return $this->idBudget;
}
/**
* Set idMode
*
* #param Frontend\EntityBundle\Entity\MasterMode $idMode
*/
public function setIdMode(\Frontend\EntityBundle\Entity\MasterMode $idMode)
{
$this->idMode = $idMode;
}
/**
* Get idMode
*
* #return Frontend\EntityBundle\Entity\MasterMode
*/
public function getIdMode()
{
return $this->idMode;
}
/**
* Set idState
*
* #param Frontend\EntityBundle\Entity\MasterState $idState
*/
public function setIdState(\Frontend\EntityBundle\Entity\MasterState $idState)
{
$this->idState = $idState;
}
/**
* Get idState
*
* #return Frontend\EntityBundle\Entity\MasterState
*/
public function getIdState()
{
return $this->idState;
}
/**
* Set idCountry
*
* #param Frontend\EntityBundle\Entity\MasterCountry $idCountry
*/
public function setIdCountry(\Frontend\EntityBundle\Entity\MasterCountry $idCountry)
{
$this->idCountry = $idCountry;
}
/**
* Get idCountry
*
* #return Frontend\EntityBundle\Entity\MasterCountry
*/
public function getIdCountry()
{
return $this->idCountry;
}
/**
* Set idHealth
*
* #param Frontend\EntityBundle\Entity\MasterHealth $idHealth
*/
public function setIdHealth(\Frontend\EntityBundle\Entity\MasterHealth $idHealth)
{
$this->idHealth = $idHealth;
}
/**
* Get idHealth
*
* #return Frontend\EntityBundle\Entity\MasterHealth
*/
public function getIdHealth()
{
return $this->idHealth;
}
/**
* Set idQualification
*
* #param Frontend\EntityBundle\Entity\MasterQualification $idQualification
*/
public function setIdQualification(\Frontend\EntityBundle\Entity\MasterQualification $idQualification)
{
$this->idQualification = $idQualification;
}
/**
* Get idQualification
*
* #return Frontend\EntityBundle\Entity\MasterQualification
*/
public function getIdQualification()
{
return $this->idQualification;
}
/**
* Set idMedium
*
* #param Frontend\EntityBundle\Entity\MasterMedium $idMedium
*/
public function setIdMedium(\Frontend\EntityBundle\Entity\MasterMedium $idMedium)
{
$this->idMedium = $idMedium;
}
/**
* Get idMedium
*
* #return Frontend\EntityBundle\Entity\MasterMedium
*/
public function getIdMedium()
{
return $this->idMedium;
}
/**
* Set idBoard
*
* #param Frontend\EntityBundle\Entity\MasterBoard $idBoard
*/
public function setIdBoard(\Frontend\EntityBundle\Entity\MasterBoard $idBoard)
{
$this->idBoard = $idBoard;
}
/**
* Get idBoard
*
* #return Frontend\EntityBundle\Entity\MasterBoard
*/
public function getIdBoard()
{
return $this->idBoard;
}
/**
* Set idUniversity
*
* #param Frontend\EntityBundle\Entity\MasterUniversity $idUniversity
*/
public function setIdUniversity(\Frontend\EntityBundle\Entity\MasterUniversity $idUniversity)
{
$this->idUniversity = $idUniversity;
}
/**
* Get idUniversity
*
* #return Frontend\EntityBundle\Entity\MasterUniversity
*/
public function getIdUniversity()
{
return $this->idUniversity;
}
/**
* Set idStream
*
* #param Frontend\EntityBundle\Entity\MasterStream $idStream
*/
public function setIdStream(\Frontend\EntityBundle\Entity\MasterStream $idStream)
{
$this->idStream = $idStream;
}
/**
* Get idStream
*
* #return Frontend\EntityBundle\Entity\MasterStream
*/
public function getIdStream()
{
return $this->idStream;
}
}
and in validation.yml
idState:
- NotBlank: { message: "Please select state.", groups: [ personalDetails ] }

Resources