Skip to content

Commit

Permalink
Merge 7d457b7 into 43c0fc3
Browse files Browse the repository at this point in the history
  • Loading branch information
ErwanLP committed Nov 9, 2018
2 parents 43c0fc3 + 7d457b7 commit 7886dfe
Showing 1 changed file with 1 addition and 42 deletions.
43 changes: 1 addition & 42 deletions src/Mouf/Mvc/Splash/Services/SplashCreateControllerService.php
Expand Up @@ -23,11 +23,10 @@ class SplashCreateControllerService
* @param string $namespace
* @param string $injectLogger
* @param string $injectTemplate
* @param string $injectDaoFactory
* @param array $actions
*/
public function generate(MoufManager $moufManager, $controllerName, $instanceName, $namespace, $injectLogger = false,
$injectTemplate = false, $injectDaoFactory = false, $actions = array())
$injectTemplate = false, $actions = array())
{
$namespace = rtrim($namespace, '\\').'\\';

Expand All @@ -48,10 +47,6 @@ public function generate(MoufManager $moufManager, $controllerName, $instanceNam

$namespace = trim($namespace, '\\');

if (!file_exists(ROOT_PATH.'../database.tdbm') && $injectDaoFactory) {
$injectDaoFactory = false;
}

// Check that instance does not already exists
if ($moufManager->has($instanceName)) {
$errors['instanceError'] = 'This instance already exists.';
Expand Down Expand Up @@ -137,13 +132,6 @@ public function generate(MoufManager $moufManager, $controllerName, $instanceNam
}
?>
use Psr\Http\Message\ResponseInterface;
<?php if ($injectDaoFactory) {
?>
use <?= $moufManager->getVariable('tdbmDefaultDaoNamespace').'\\Generated\\'.$moufManager->getVariable('tdbmDefaultDaoFactoryName') ?>;
<?php

}
?>
<?php if ($injectTwig) {
?>
use \Twig_Environment;
Expand Down Expand Up @@ -207,18 +195,6 @@ class <?= $controllerName ?> {

<?php

}
?>
<?php if ($injectDaoFactory) {
?>
/**
* The DAO factory object.
* @var DaoFactory
*/
private $daoFactory;

<?php

}
?>
<?php if ($injectTwig) {
Expand All @@ -244,9 +220,6 @@ class <?= $controllerName ?> {
echo " * @param TemplateInterface \$template The template used by this controller\n";
echo " * @param HtmlBlock \$content The main content block of the page\n";
}
if ($injectDaoFactory) {
echo " * @param DaoFactory \$daoFactory The object in charge of retrieving DAOs\n";
}
if ($injectTwig) {
echo " * @param Twig_Environment \$twig The Twig environment (used to render Twig templates)\n";
}
Expand All @@ -261,9 +234,6 @@ public function __construct(<?php
$parameters[] = 'TemplateInterface $template';
$parameters[] = 'HtmlBlock $content';
}
if ($injectDaoFactory) {
$parameters[] = 'DaoFactory $daoFactory';
}
if ($injectTwig) {
$parameters[] = 'Twig_Environment $twig';
}
Expand All @@ -281,12 +251,6 @@ public function __construct(<?php
$this->content = $content;
<?php

}
if ($injectDaoFactory) {
?>
$this->daoFactory = $daoFactory;
<?php

}
if ($injectTwig) {
?>
Expand Down Expand Up @@ -416,11 +380,6 @@ public function <?= $action['method'] ?>(<?php
$controllerInstance->getProperty('content')->setValue($moufManager->getInstanceDescriptor('block.content'));
}
}
if ($injectDaoFactory) {
if ($moufManager->has('daoFactory')) {
$controllerInstance->getProperty('daoFactory')->setValue($moufManager->getInstanceDescriptor('daoFactory'));
}
}
if ($injectTwig) {
if ($moufManager->has('twigEnvironment')) {
$controllerInstance->getProperty('twig')->setValue($moufManager->getInstanceDescriptor('twigEnvironment'));
Expand Down

0 comments on commit 7886dfe

Please sign in to comment.