<commit_before><?php

namespace CultuurNet\UDB3\Label\ReadModels\Relations\Repository\Doctrine;

use CultuurNet\UDB3\Label\ReadModels\Doctrine\AbstractDBALRepository;
use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\OfferLabelRelation;
use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\ReadRepositoryInterface;
use CultuurNet\UDB3\Offer\OfferType;
use ValueObjects\Identity\UUID;

class ReadRepository extends AbstractDBALRepository implements ReadRepositoryInterface
{
    /**
     * @inheritdoc
     */
    public function getOfferLabelRelations(UUID $labelId)
    {
//        TODO: This one gives a cryptic error message: " Illegal offset type"
//        $queryBuilder = $this->createQueryBuilder()
//            ->select(SchemaConfigurator::RELATION_ID_COLUMN)
//            ->from($this->getTableName())
//            ->where(SchemaConfigurator::UUID_COLUMN . ' = :label_id')
//            ->setParameter(':label_id', (string) $labelId);
//
//        $results = $queryBuilder->execute();

        $query = $this
            ->getConnection()
            ->prepare(
                'SELECT * ' .
                ' FROM ' . $this->getTableName() .
                ' WHERE ' . SchemaConfigurator::UUID_COLUMN . ' = ?'
            );

        $query->bindValue(1, $labelId, 'string');
        $query->execute();

        return array_map(
            array(OfferLabelRelation::class, 'fromRelationalData'),
            $query->fetchAll(\PDO::FETCH_ASSOC)
        );
    }
}<commit_msg>III-1107: Remove unnecessary todo.<commit_after><?php

namespace CultuurNet\UDB3\Label\ReadModels\Relations\Repository\Doctrine;

use CultuurNet\UDB3\Label\ReadModels\Doctrine\AbstractDBALRepository;
use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\OfferLabelRelation;
use CultuurNet\UDB3\Label\ReadModels\Relations\Repository\ReadRepositoryInterface;
use CultuurNet\UDB3\Offer\OfferType;
use ValueObjects\Identity\UUID;

class ReadRepository extends AbstractDBALRepository implements ReadRepositoryInterface
{
    /**
     * @inheritdoc
     */
    public function getOfferLabelRelations(UUID $labelId)
    {
        $query = $this
            ->getConnection()
            ->prepare(
                'SELECT * ' .
                ' FROM ' . $this->getTableName() .
                ' WHERE ' . SchemaConfigurator::UUID_COLUMN . ' = ?'
            );

        $query->bindValue(1, $labelId, 'string');
        $query->execute();

        return array_map(
            array(OfferLabelRelation::class, 'fromRelationalData'),
            $query->fetchAll(\PDO::FETCH_ASSOC)
        );
    }
}
{'fraction_non_alphanumeric': 0.1245196003074558, 'fraction_numerical': 0.006149116064565719, 'mean_word_length': 2.6974431818181817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '376325', 'n_tokens_mistral': 785, 'n_tokens_neox': 774, 'n_words': 109}