Created
August 13, 2020 17:01
-
-
Save caiaffa/249ab2258b7bf15d544ecc0dc3d8a663 to your computer and use it in GitHub Desktop.
This file contains 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
public function findDataByProductId(int $productId) | |
{ | |
$qb = $this->createQueryBuilder('p'); | |
$qb | |
->select('p, pmmp') | |
->leftJoin('p.contractsRenovation', 'pmmp') | |
->where('p.id = :productId') | |
->setParameter('productId', $productId); | |
return \array_map( | |
function (array $result) { | |
return new ProductDto($result['name'], $result['contractsRenovation']); | |
}, | |
$qb->getQuery()->getResult(Query::HYDRATE_ARRAY) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment