/** * @Transform /^classified as "([^"]+)"$/ * @Transform /^belongs to "([^"]+)"$/ */ public function getTaxonByName($taxonName) { $taxon = $this->taxonRepository->findOneByName($taxonName); if (null === $taxon) { throw new \InvalidArgumentException(sprintf('Taxon with name "%s" does not exist.', $taxonName)); } return $taxon; }
/** * @Transform /^classified as "([^"]+)"$/ * @Transform /^belongs to "([^"]+)"$/ * @Transform /^"([^"]+)" taxon$/ * @Transform /^"([^"]+)" as a parent taxon$/ * @Transform /^"([^"]+)" parent taxon$/ * @Transform /^parent taxon to "([^"]+)"$/ * @Transform /^taxon with "([^"]+)" name/ * @Transform /^taxon "([^"]+)"$/ */ public function getTaxonByName($name) { $taxon = $this->taxonRepository->findOneByName($name); Assert::notNull($taxon, sprintf('Taxon with name "%s" does not exist.', $name)); return $taxon; }