Created
June 5, 2017 16:09
-
-
Save guilhermeblanco/1b736414a56aa261591f5b62b07b60dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity | |
*/ | |
class Client | |
{ | |
/** | |
* @ORM\Column(type="bigint") | |
* @ORM\Id @ORM\AutoGenerated | |
*/ | |
public $id; | |
/** ... */ | |
public $clientStore; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity | |
*/ | |
class ClientStore | |
{ | |
/** | |
* @ORM\Column(type="bigint") | |
* @ORM\Id @ORM\AutoGenerated | |
*/ | |
public $id; | |
/** ... */ | |
public $location; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace AppBundle\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @ORM\Entity | |
*/ | |
class Location | |
{ | |
/** | |
* @ORM\Column(type="bigint") | |
* @ORM\Id @ORM\AutoGenerated | |
*/ | |
public $id; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$qb = $entityManager->createQueryBuilder(); | |
$qb | |
->select(['c', 'cs', 'l']) | |
->from('AppBundle\Entity\Client', 'c') | |
->innerJoin('c.clientStore', 'cs') | |
->innerJoin('cs.location', 'l') | |
->where('l.id = :location_id') | |
->addParameter('location_id', 123) | |
$result = $qb->getQuery()->getResult(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment