/**
  * Search entities by primary key
  *
  * @param $keys[]
  *
  * @return array
  */
 public function findValueByPrimaryKey($keys)
 {
     $keyField = $this->dictionaryHelper->getNamePrimaryKeyField($this->getMetadata());
     $labelField = $this->dictionaryHelper->getNameLabelField($this->getMetadata());
     $qb = $this->getListQueryBuilder(-1, 1, [], null, []);
     $qb->andWhere('e.' . $keyField . ' in (:keys)')->setParameter('keys', $keys);
     $query = $qb->getQuery();
     $results = $query->getResult();
     return $this->prepareData($results, $keyField, $labelField);
 }
 /**
  * Search entities by primary key
  *
  * @param $keys[]
  *
  * @return array
  */
 public function findValueByPrimaryKey($keys)
 {
     $entityMetadata = $this->entityConfigManager->getEntityMetadata($this->class);
     $keyField = $this->dictionaryHelper->getNamePrimaryKeyField($this->getMetadata());
     $searchFields = $this->dictionaryHelper->getSearchFields($this->getMetadata(), $entityMetadata);
     $representationField = $this->dictionaryHelper->getRepresentationField($this->getMetadata(), $entityMetadata);
     $qb = $this->getListQueryBuilder(-1, 1, [], null, []);
     $qb->andWhere('e.' . $keyField . ' in (:keys)');
     $qb->setParameter('keys', $keys);
     $query = $qb->getQuery();
     $results = $query->getResult();
     return $this->prepareData($results, $keyField, $searchFields, $representationField);
 }
 /**
  * @param array $fieldNames
  * @param array $representationField
  * @param mixed $expected
  *
  * @dataProvider getRepresentationFieldDataProvider
  */
 public function testGetRepresentationField($fieldNames, $representationField, $expected)
 {
     $this->classMetadataMock->method("getFieldNames")->willReturn($fieldNames);
     $this->entityMetadataMock->defaultValues = array('dictionary' => array('representation_field' => $representationField));
     $this->assertEquals($expected, $this->dictionaryHelper->getRepresentationField($this->classMetadataMock, $this->entityMetadataMock));
 }