for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace CultuurNet\UDB3\Label\ReadModels\Relations\Repository\Doctrine;
use CultuurNet\UDB3\Label\ReadModels\Doctrine\AbstractDBALRepository;
use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\LabelRelation;
use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\ReadRepositoryInterface;
use ValueObjects\Identity\UUID;
class ReadRepository extends AbstractDBALRepository implements ReadRepositoryInterface
{
/**
* @inheritdoc
*/
public function getLabelRelations(UUID $labelId)
$aliases = $this->getAliases();
$whereUuid = SchemaConfigurator::UUID_COLUMN . ' = ?';
$queryBuilder = $this->createQueryBuilder()->select($aliases)
->from($this->getTableName()->toNative())
->where($whereUuid)
->setParameters([$labelId]);
$statement = $queryBuilder->execute();
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
$labelRelation = LabelRelation::fromRelationalData($row);
yield $labelRelation;
}
* @return array
private function getAliases()
return [
SchemaConfigurator::UUID_COLUMN,
SchemaConfigurator::RELATION_TYPE_COLUMN,
SchemaConfigurator::RELATION_ID_COLUMN
];