public function testGetIdentifier() { $localisation = $this->genericEntityManager->getEntity('recolnat', 'localisation', 15248883); $this->string($this->genericEntityManager->getIdentifierName($localisation))->isEqualTo('locationid'); $this->exception(function ($localisation) { $this->genericEntityManager->getIdentifierName($localisation); })->isInstanceOf('Exception'); $localisation = 'localisation'; $this->string($this->genericEntityManager->getIdentifierName($localisation))->isEqualTo('locationid'); }
/** * * @param string $className * @param array $arrayEntity * @return array */ public function getChoicesForEntity($className, $arrayEntity) { $returnChoices = []; if (array_key_exists($this->genericEntityManager->getIdentifierName($className), $arrayEntity)) { $relationId = $arrayEntity[$this->genericEntityManager->getIdentifierName($className)]; foreach ($this->getChoices() as $row) { if ($row['className'] == $className && $row['relationId'] == $relationId) { $returnChoices[] = $row; } } } return $returnChoices; }