Skip to content

Unify the way to provide expression functions for the DI container #13013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,14 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac
$this->expressionLanguageProviders[] = $provider;
}

/**
* @return ExpressionFunctionProviderInterface[]
*/
public function getExpressionLanguageProviders()
{
return $this->expressionLanguageProviders;
}

/**
* Returns the Service Conditionals.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,11 @@ public function dumpParameter($name)
return sprintf("\$this->getParameter('%s')", strtolower($name));
}

/**
* @deprecated Deprecated since 2.6.2, to be removed in 3.0. Use Symfony\Component\DependencyInjection\ContainerBuilder::addExpressionLanguageProvider instead.
*
* @param ExpressionFunctionProviderInterface $provider
*/
public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
{
$this->expressionLanguageProviders[] = $provider;
Expand Down Expand Up @@ -1493,7 +1498,8 @@ private function getExpressionLanguage()
if (!class_exists('Symfony\Component\ExpressionLanguage\ExpressionLanguage')) {
throw new RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed.');
}
$this->expressionLanguage = new ExpressionLanguage(null, $this->expressionLanguageProviders);
$providers = array_merge($this->container->getExpressionLanguageProviders(), $this->expressionLanguageProviders);
$this->expressionLanguage = new ExpressionLanguage(null, $providers);
}

return $this->expressionLanguage;
Expand Down