Skip to content

[DependencyInjection] simplify the BC layer #17565

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
Jan 27, 2016
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 @@ -44,10 +44,7 @@ public function process(ContainerBuilder $container)
$definition->setMethodCalls($this->processArguments($definition->getMethodCalls()));
$definition->setProperties($this->processArguments($definition->getProperties()));
$definition->setFactory($this->processFactory($definition->getFactory()));

if (null !== $factoryService = $definition->getFactoryService(false)) {
$definition->setFactoryService($this->processFactoryService($factoryService));
}
$definition->setFactoryService($this->processFactoryService($definition->getFactoryService(false)), false);
}

foreach ($container->getAliases() as $id => $alias) {
Expand Down
6 changes: 4 additions & 2 deletions src/Symfony/Component/DependencyInjection/Definition.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ public function getFactoryMethod($triggerDeprecationError = true)
*
* @deprecated since version 2.6, to be removed in 3.0.
*/
public function setFactoryService($factoryService)
public function setFactoryService($factoryService, $triggerDeprecationError = true)
{
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
if ($triggerDeprecationError) {
@trigger_error(sprintf('%s(%s) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead.', __METHOD__, $factoryService), E_USER_DEPRECATED);
}

$this->factoryService = $factoryService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function setFactoryMethod($method)
/**
* {@inheritdoc}
*/
public function setFactoryService($service)
public function setFactoryService($service, $triggerDeprecationError = true)
{
$this->changes['factory_service'] = true;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't you forget to spread the new argument to the parent ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch, we never call this internally so this went unnoticed. Would you like to send a fix?

Expand Down