Skip to content
This repository has been archived by the owner on Nov 8, 2019. It is now read-only.

OAuthBundle - portabilité between Symfony older than 2.6 and newest #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions DependencyInjection/APinneckeOAuthExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public function load(array $configs, ContainerBuilder $container)
$lowerName = strtolower($name);

$definition = new Definition();
if (method_exists($definition, 'setFactory')) {
// to be inlined when dependency on Symfony DependencyInjection is newer than 2.5.9
$definition->setFactory(array(new Reference('apinnecke_oauth.service_factory'), 'createService'));
} else {
// to be removed when dependency on Symfony DependencyInjection is older than 2.6
$definition->setFactoryService('apinnecke_oauth.service_factory');
$definition->setFactoryMethod('createService');
}
$definition->setFactory(array(new Reference('apinnecke_oauth.service_factory'), 'createService'));
Copy link
Owner

Choose a reason for hiding this comment

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

This line should be removed, since it was moved inside the if clause

$definition->setClass('%apinnecke_oauth.service.' . $lowerName . '.class%');
$definition->addArgument($name);
Expand Down