Skip to content

Commit

Permalink
NotificationSettingService
Browse files Browse the repository at this point in the history
  • Loading branch information
pepakriz committed Oct 15, 2014
1 parent f4b92da commit b7c1f8b
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ public function create()
->setOption(IComponentMapper::ITEMS_TITLE, 'email')
->setPrompt('all');

$form->setCurrentGroup();
$form->addSubmit('_submit', 'Save');

return $form;
}

Expand Down
41 changes: 41 additions & 0 deletions src/Notifications/AdminModule/NotificationSettingFormService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/**
* This file is part of the Venne:CMS (https://github.com/Venne)
*
* Copyright (c) 2011, 2012 Josef Kříž (http://www.josef-kriz.cz)
*
* For the full copyright and license information, please view
* the file license.txt that was distributed with this source code.
*/

namespace Venne\Notifications\AdminModule;

use Doctrine\ORM\EntityManager;
use Kdyby\Doctrine\Entities\BaseEntity;
use Kdyby\DoctrineForms\EntityFormMapper;
use Venne\Notifications\NotificationSetting;

/**
* @author Josef Kříž <[email protected]>
*/
class NotificationSettingFormService extends \Venne\System\DoctrineFormService
{

public function __construct(
NotificationSettingFormFactory $formFactory,
EntityManager $entityManager,
EntityFormMapper $entityFormMapper
) {
parent::__construct($formFactory, $entityManager, $entityFormMapper);
}

/**
* @return string
*/
protected function getEntityClassName()
{
return NotificationSetting::class;
}

}
11 changes: 5 additions & 6 deletions src/Notifications/AdminModule/SettingsPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,19 @@ class SettingsPresenter extends \Nette\Application\UI\Presenter
/** @var \Venne\System\Components\AdminGrid\IAdminGridFactory */
private $adminGridFactory;

/** @var \Venne\Notifications\AdminModule\NotificationSettingFormFactory */
private $notificationSettingFormFactory;
/** @var \Venne\Notifications\AdminModule\NotificationSettingFormService */
private $notificationSettingFormService;

public function __construct(
EntityManager $entityManager,
NotificationManager $notificationManager,
IAdminGridFactory $adminGridFactory,
NotificationSettingFormFactory $notificationSettingFormFactory
)
{
NotificationSettingFormService $notificationSettingFormService
) {
$this->notificationSettingRepository = $entityManager->getRepository(NotificationSetting::class);
$this->notificationManager = $notificationManager;
$this->adminGridFactory = $adminGridFactory;
$this->notificationSettingFormFactory = $notificationSettingFormFactory;
$this->notificationSettingFormService = $notificationSettingFormService;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/Notifications/DI/NotificationsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class NotificationsExtension extends \Nette\DI\CompilerExtension implements
public function loadConfiguration()
{
$container = $this->getContainerBuilder();
$this->compiler->parseServices(
$container,
$this->loadFromFile(__DIR__ . '/services.neon')
);
$config = $this->getConfig($this->defaults);

$notificationManager = $container->addDefinition($this->prefix('notificationManager'))
Expand Down Expand Up @@ -73,9 +77,6 @@ public function loadConfiguration()

$container->addDefinition($this->prefix('emailJob'))
->setClass('Venne\Notifications\Jobs\EmailJob');

$container->addDefinition($this->prefix('notificationSettingFormFactory'))
->setClass('Venne\Notifications\AdminModule\NotificationSettingFormFactory', array(new Statement('@system.admin.ajaxFormFactory')));
}

public function beforeCompile()
Expand Down
4 changes: 4 additions & 0 deletions src/Notifications/DI/services.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:

- Venne\Notifications\AdminModule\NotificationSettingFormFactory (@system.admin.ajaxFormFactory)
- Venne\Notifications\AdminModule\NotificationSettingFormService

0 comments on commit b7c1f8b

Please sign in to comment.