<?php

namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query;

/**
 * TestimonialRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class TestimonialRepository extends \Doctrine\ORM\EntityRepository
{
    /**
     * Get List with only id and name by a set of criteria.
     *
     * Optionally sorting and limiting details can be passed. An implementation may throw
     * an UnexpectedValueException if certain values of the sorting or limiting details are
     * not supported.
     *
     * @param array      $criteria
     * @param array|null $orderBy
     * @param int|null   $limit
     * @param int|null   $offset
     *
     * @return array The objects.
     *
     * @throws \UnexpectedValueException
     */
    public function findSimpleListBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) 
    {
        $items_list = array();

        $tmp = $this->findBy($criteria, $orderBy, $limit, $offset);

        foreach($tmp as $item) {
            $items_list[$item->getId()] = $item->getWitness();
        }

        return $items_list;
    } 
}
