@ORM\Table(name="company_contact", indexes={@ORM\Index(name="companyRole", 
columns={"companyRole"}), @ORM\Index(name="idContact", 
columns={"idContact"}), @ORM\Index(name="idBranch", columns={"idBranch"}), 
@ORM\Index(name="idCompany", columns={"idCompany"})})
 * @ORM\Entity 
(repositoryClass="Application\Model\Repository\CompanyContactRepository")
 */
class CompanyContact
{
    /**
     * @var \Application\Model\ORMEntity\Company
     *
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="NONE")
     * @ORM\OneToOne(targetEntity="Application\Model\ORMEntity\Company")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="idCompany", referencedColumnName="idCompany")
     * })
     */
    private $idcompany;

    /**
     * @var \Application\Model\ORMEntity\CompanyBranch
     *
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="NONE")
     * 
@ORM\OneToOne(targetEntity="Application\Model\ORMEntity\CompanyBranch")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="idBranch", referencedColumnName="idBranch")
     * })
     */
    private $idbranch;

    /**
     * @var \Application\Model\ORMEntity\Contact
     *
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="NONE")
     * @ORM\OneToOne(targetEntity="Application\Model\ORMEntity\Contact")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="idContact", referencedColumnName="idContact")
     * })
     */
    private $idcontact;
(...)
}


If I do the following query using DQL:
 $em = $this->getEntityManager();

 $query = $em->createQuery("SELECT c, c2, r, b, t, a  FROM 
Application\Model\ORMEntity\CompanyContact c JOIN c.idcontact c2 JOIN 
c.idbranch b JOIN b.idaddress a JOIN b.typeofbranch t JOIN c.companyrole r 
WHERE c.idcompany = :idcompany");

$query->setParameter("idcompany", $idCompany);

$companyContacts = $query->getResult(Query::HYDRATE_ARRAY);

The return associative arrays dont have the associations instantiated (i.e. 
I just get array("idCompany" => 1, "idBranch" => 1, "idContact" => 1)). If 
I use the default hydration mode, I get all the associations instantiated. 
Am I missing something in my code to get the associative array with all 
associations instantiated?

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to