Skip to content

Commit

Permalink
Drop injection of DaoFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
xhuberty committed Mar 11, 2016
1 parent a387bbe commit a49364b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 44 deletions.
40 changes: 1 addition & 39 deletions src/Mouf/Mvc/Splash/Services/SplashCreateControllerService.php
Original file line number Diff line number Diff line change
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,12 +132,6 @@ public function generate(MoufManager $moufManager, $controllerName, $instanceNam
?>
use Psr\Log\LoggerInterface;
<?php
}
?>
<?php if ($injectDaoFactory) {
?>
use <?= $moufManager->getVariable('tdbmDefaultDaoNamespace').'\\'.$moufManager->getVariable('tdbmDefaultDaoFactoryName') ?>;
<?php
}
?>
<?php if ($injectTwig) {
Expand Down Expand Up @@ -201,17 +190,6 @@ class <?= $controllerName ?> extends Controller {
*/
private $content;

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

<?php
}
?>
Expand All @@ -237,9 +215,6 @@ class <?= $controllerName ?> extends Controller {
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 @@ -254,9 +229,6 @@ public function __construct(<?php
$parameters[] = 'TemplateInterface $template';
$parameters[] = 'HtmlBlock $content';
}
if ($injectDaoFactory) {
$parameters[] = 'DaoFactory $daoFactory';
}
if ($injectTwig) {
$parameters[] = 'Twig_Environment $twig';
}
Expand All @@ -271,11 +243,6 @@ public function __construct(<?php
?>
$this->template = $template;
$this->content = $content;
<?php
}
if ($injectDaoFactory) {
?>
$this->daoFactory = $daoFactory;
<?php
}
if ($injectTwig) {
Expand Down Expand Up @@ -408,11 +375,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
6 changes: 1 addition & 5 deletions src/views/admin/createController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

<script type="text/javascript">
globalData = <?php echo json_encode(array(
'namespace' => $this->controllerNamespace,
'tdbmExists' => file_exists(ROOT_PATH.'../database.tdbm'),
'namespace' => $this->controllerNamespace
)); ?>
</script>

Expand Down Expand Up @@ -52,9 +51,6 @@
<label class="checkbox inline">
<input type="checkbox" ng-model="injectTemplate" /> Template and content block
</label>
<label class="checkbox inline" ng-show="tdbmExists">
<input type="checkbox" ng-model="injectDaoFactory" /> DAO Factory
</label>
</div>
</div>

Expand Down

0 comments on commit a49364b

Please sign in to comment.