/** * {@inheritdoc} */ public function findAssetMappings(Expression $expr) { $descriptors = $this->discoveryManager->findBindingDescriptors($this->exprBuilder->buildExpression($expr)); $mappings = array(); foreach ($descriptors as $descriptor) { $mappings[] = $this->bindingToMapping($descriptor->getBinding()); } return $mappings; }
/** * @param string $uuidPrefix * * @return BindingDescriptor */ private function getBindingByUuidPrefix($uuidPrefix) { $expr = Expr::method('getUuid', Expr::startsWith($uuidPrefix)); $descriptors = $this->discoveryManager->findBindingDescriptors($expr); if (0 === count($descriptors)) { throw new RuntimeException(sprintf('The binding "%s" does not exist.', $uuidPrefix)); } if (count($descriptors) > 1) { throw new RuntimeException(sprintf('More than one binding matches the UUID prefix "%s".', $uuidPrefix)); } return reset($descriptors); }