-
-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency on
symfony/templating
(#476)
- Loading branch information
1 parent
b2f2563
commit 160da4a
Showing
28 changed files
with
84 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,22 +17,12 @@ | |
use Sonata\BlockBundle\Model\BlockInterface; | ||
use Sonata\CoreBundle\Model\Metadata; | ||
use Sonata\CoreBundle\Validator\ErrorElement; | ||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; | ||
|
||
/** | ||
* @author Christian Gripp <[email protected]> | ||
*/ | ||
abstract class AbstractAdminBlockService extends AbstractBlockService implements AdminBlockServiceInterface | ||
{ | ||
/** | ||
* @param string $name | ||
* @param EngineInterface $templating | ||
*/ | ||
public function __construct($name, EngineInterface $templating) | ||
{ | ||
parent::__construct($name, $templating); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,10 @@ | |
|
||
use Sonata\BlockBundle\Block\BlockContextInterface; | ||
use Sonata\BlockBundle\Model\BlockInterface; | ||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
use Twig\Environment; | ||
|
||
/** | ||
* @author Sullivan Senechal <[email protected]> | ||
|
@@ -31,25 +31,14 @@ abstract class AbstractBlockService implements BlockServiceInterface | |
protected $name; | ||
|
||
/** | ||
* @var EngineInterface|null | ||
* @var Environment | ||
*/ | ||
protected $templating; | ||
private $twig; | ||
|
||
/** | ||
* @param string $name | ||
* @param EngineInterface $templating | ||
*/ | ||
public function __construct($name = null, EngineInterface $templating = null) | ||
public function __construct(string $name, Environment $twig) | ||
{ | ||
if (null === $name || null === $templating) { | ||
@trigger_error( | ||
'The $name and $templating parameters will be required fields with the 4.0 release.', | ||
E_USER_DEPRECATED | ||
); | ||
} | ||
|
||
$this->name = $name; | ||
$this->templating = $templating; | ||
$this->twig = $twig; | ||
} | ||
|
||
/** | ||
|
@@ -63,7 +52,11 @@ public function __construct($name = null, EngineInterface $templating = null) | |
*/ | ||
public function renderResponse($view, array $parameters = [], Response $response = null) | ||
{ | ||
return $this->getTemplating()->renderResponse($view, $parameters, $response); | ||
$response = $response ?? new Response(); | ||
|
||
$response->setContent($this->twig->render($view, $parameters)); | ||
|
||
return $response; | ||
} | ||
|
||
/** | ||
|
@@ -157,8 +150,8 @@ public function getName() | |
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getTemplating() | ||
public function getTwig() | ||
{ | ||
return $this->templating; | ||
return $this->twig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,13 +23,13 @@ | |
use Sonata\CoreBundle\Form\Type\ImmutableArrayType; | ||
use Sonata\CoreBundle\Model\Metadata; | ||
use Sonata\CoreBundle\Validator\ErrorElement; | ||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; | ||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormTypeInterface; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
use Twig\Environment; | ||
|
||
/** | ||
* @author Hugo Briand <[email protected]> | ||
|
@@ -56,14 +56,11 @@ class MenuBlockService extends AbstractAdminBlockService | |
protected $menuRegistry; | ||
|
||
/** | ||
* @param string $name | ||
* @param EngineInterface $templating | ||
* @param MenuProviderInterface $menuProvider | ||
* @param MenuRegistryInterface|null $menuRegistry | ||
*/ | ||
public function __construct($name, EngineInterface $templating, MenuProviderInterface $menuProvider, $menuRegistry = null) | ||
public function __construct(string $name, Environment $twig, MenuProviderInterface $menuProvider, $menuRegistry = null) | ||
{ | ||
parent::__construct($name, $templating); | ||
parent::__construct($name, $twig); | ||
|
||
$this->menuProvider = $menuProvider; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.