Unused use statement should be avoided

This commit is contained in:
Simon Vieille 2015-03-05 19:12:40 +01:00
parent de84965946
commit 07d50a28e8
47 changed files with 111 additions and 194 deletions

View file

@ -8,11 +8,8 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Sensio\Bundle\GeneratorBundle\Command\Helper\DialogHelper;
use Symfony\Component\Filesystem\Exception\IOException;
use Sensio\Bundle\GeneratorBundle\Command\Validators;
class GenerateCrudCommand extends ContainerAwareCommand
{
/**
@ -113,7 +110,7 @@ EOT
/* ------------------------------------------ */
$errors = array();
$runner = $dialog->getRunner($output, $errors);
$dialog->getRunner($output, $errors);
/* ------------------------------------------ */

View file

@ -7,7 +7,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\File\File;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Pagerfanta\Adapter\PropelAdapter;

View file

@ -18,7 +18,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('trinity_admin');
$treeBuilder->root('trinity_admin');
/*$rootNode
->children()
@ -29,8 +29,8 @@ class Configuration implements ConfigurationInterface
->defaultFalse()
->end()
->arrayNode('langs')
->info('Langs configuration')
->requiresAtLeastOneElement()
->info('Langs configuration')
->requiresAtLeastOneElement()
->prototype('array')->end()
->end()
->end()
@ -41,7 +41,6 @@ class Configuration implements ConfigurationInterface
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
return $treeBuilder;
}
}

View file

@ -6,7 +6,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Definition;
/**
* This is the class that loads and manages your bundle configuration

View file

@ -3,7 +3,6 @@
namespace Trinity\Component\File;
use Symfony\Component\HttpFoundation\File\File;
use Trinity\Component\Exception\FileMethodNotFoundException;
class FileUploadCallback
{

View file

@ -12,7 +12,6 @@
namespace Trinity\Bundle\AssetsBundle\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;

View file

@ -2,18 +2,11 @@
namespace Trinity\Bundle\ContactBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\UserBundle\Flash\FlashError;
use Trinity\Bundle\UserBundle\Flash\FlashSuccess;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Response;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Trinity\Bundle\ContactBundle\Configuration\ContactCrudConfiguration as CrudConfiguration;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;
use Trinity\Bundle\ContactBundle\Form\Type\BatchType;

View file

@ -4,9 +4,6 @@ namespace Trinity\Bundle\ContactBundle\Controller;
use Trinity\Bundle\ContactBundle\Form\Type\ContactType;
use Trinity\Bundle\ContentManagerBundle\Controller\PageController;
use Trinity\Bundle\UserBundle\Flash\FlashError;
use Trinity\Bundle\UserBundle\Flash\FlashSuccess;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Response;

View file

@ -4,7 +4,6 @@ namespace Trinity\Bundle\ContentManagerBundle\Block;
use Propel;
use PropelPDO;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Trinity\Bundle\ContentManagerBundle\Model\BlockPeer;
use Trinity\Bundle\ContentManagerBundle\Model\Block;

View file

@ -6,7 +6,6 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
class CacheClearRoutingCommand extends ContainerAwareCommand
{

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
@ -105,6 +104,6 @@ class MenuAdminController extends BaseAdminController
{
$object->createRootNode();
return parent::postSave($object, $wasNew = false);
return parent::postSave($object, $wasNew);
}
}

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
@ -163,6 +162,6 @@ class NavigationAdminController extends BaseAdminController
{
$object->createRootNode();
return parent::postSave($object, $wasNew = false);
return parent::postSave($object, $wasNew);
}
}

View file

@ -16,7 +16,6 @@ use Trinity\Bundle\ContentManagerBundle\Form\Type\NodeAltType;
use Trinity\Bundle\ContentManagerBundle\Form\Type\NodeAddType;
use Trinity\Bundle\ContentManagerBundle\Form\Type\NodeMoveType;
use Trinity\Bundle\ContentManagerBundle\Form\Type\NodeRemoveType;
use Trinity\Bundle\ContentManagerBundle\Model\Page;
/**
* @Route("/admin/cms")

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

View file

@ -3,7 +3,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Trinity\Bundle\ContentManagerBundle\Event\SecurityEvent;
use Trinity\Bundle\ContentManagerBundle\Model\Page;

View file

@ -4,7 +4,6 @@ namespace Trinity\Bundle\ContentManagerBundle\Event;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\SecurityContextInterface;
class SecurityEvent extends Event

View file

@ -3,9 +3,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Form\Type;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents;
use Trinity\Bundle\ContentManagerBundle\Block\FileBlock;
class FileImageBlockType extends BlockType
{

View file

@ -54,7 +54,7 @@ class Node extends BaseNode
public function getRealRouteName()
{
if ($navId = $this->getNavId()) {
if ($this->getNavId()) {
return $this->getNavId().'_'.$this->getRouteName();
}

View file

@ -395,7 +395,6 @@ class Page extends BasePage implements SeoPageInterface, IndexableInterface
$this->addMetaWordsByMap($model->getPeer()->getTableMap());
if (array_key_exists('i18n', $model->getPeer()->getTableMap()->getBehaviors())) {
$i18n_map = $model->getTranslation()->getPeer()->getTableMap();
$this->addMetaWordsByMap($model->getTranslation()->getPeer()->getTableMap());
}
}

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Page;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
interface DecoratorStrategyInterface

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Page;
use Trinity\Bundle\ContentManagerBundle\Model\Nav;
use Trinity\Bundle\ContentManagerBundle\Navigation\NavigationInterface;
use \Trinity\Bundle\ContentManagerBundle\Model\Node;
use \Trinity\Bundle\ContentManagerBundle\Block\BlockManager;

View file

@ -13,7 +13,7 @@ class NodeLoader extends Loader
/**
* Loads a resource.
*
* @param mixed $resource The resource
* @param mixed $resource The resource
* @param string $type The resource type
* Deprecated method
*/
@ -39,7 +39,6 @@ class NodeLoader extends Loader
$routeName = $node->getRealRouteName() ? $node->getRealRouteName() : sprintf('cms_node_%d', $id);
if ($node->getNodeAlias()) {
$p = $node;
$node = $node->getNodeRelatedByNodeAlias();
}
@ -107,7 +106,7 @@ class NodeLoader extends Loader
/**
* Returns true if this class supports the given resource.
*
* @param mixed $resource A resource
* @param mixed $resource A resource
* @param string $type The resource type
*
* @return Boolean true if this class supports the given resource, false otherwise

View file

@ -4,7 +4,6 @@ namespace Trinity\Bundle\ContentManagerBundle\Routing;
use Symfony\Bundle\FrameworkBundle\Routing\Router as BaseRouter;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Trinity\Bundle\ContentManagerBundle\Page\PageManager;
use Trinity\Bundle\ContentManagerBundle\Model\NavQuery;
use Trinity\Bundle\ContentManagerBundle\Exception\NavigationNotFoundException;

View file

@ -3,8 +3,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Twig\Extension;
use Trinity\Bundle\ContentManagerBundle\Exception\BlockNotFoundException;
use Trinity\Bundle\ContentManagerBundle\Model\Page;
use Trinity\Bundle\ContentManagerBundle\Model\Block;
use \Trinity\Bundle\ContentManagerBundle\Block\BlockManager;
use \Symfony\Component\Routing\RouterInterface;
use \Trinity\Bundle\ContentManagerBundle\Page\PageManagerSelectorInterface;
@ -12,7 +10,6 @@ use \Trinity\Bundle\ContentManagerBundle\Page\PageManagerSelectorInterface;
class BlockExtension extends \Twig_Extension
{
private $environment;
private $code_render;
private $resources;
private $blockManager;

View file

@ -3,8 +3,6 @@
namespace Trinity\Bundle\ContentManagerBundle\Twig\Extension;
use Trinity\Bundle\ContentManagerBundle\Model\Node;
use Trinity\Bundle\ContentManagerBundle\Model\Page;
use Trinity\Bundle\ContentManagerBundle\Model\Block;
use \Trinity\Bundle\ContentManagerBundle\Block\BlockManager;
use \Trinity\Bundle\ContentManagerBundle\Page\PageManagerSelectorInterface;
use \Trinity\Bundle\ContentManagerBundle\Model\NodeQuery;

View file

@ -4,7 +4,6 @@ namespace Trinity\Bundle\ContentManagerBundle\Twig\Extension;
use Symfony\Component\Routing\Generator\UrlGenerator;
use Trinity\Bundle\ContentManagerBundle\Model\Node;
use Trinity\Bundle\ContentManagerBundle\Model\Page;
use \Trinity\Bundle\ContentManagerBundle\Page\PageManagerSelectorInterface;
use \Trinity\Bundle\ContentManagerBundle\Model\NodeQuery;

View file

@ -5,7 +5,6 @@ namespace Trinity\Bundle\DashBoardBundle\DashBoard;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Trinity\Bundle\SecurityBundle\AccessControl\RouteAccessControl;
use Trinity\Bundle\DashBoardBundle\DashBoard\DashBoard;
use Trinity\Bundle\DashBoardBundle\Zone\Zone;
class ConfigurationTransformer
{

View file

@ -2,9 +2,7 @@
namespace Trinity\Bundle\EditorialBlockBundle\Block;
use Symfony\Component\HttpFoundation\File\File;
use Trinity\Bundle\ContentManagerBundle\Model\Block;
use Trinity\Component\File\FileUploadInterface;
use Trinity\Bundle\EditorialBlockBundle\Model\EditorialBlockQuery;
class EditorialBlocksContainerBlock extends Block

View file

@ -2,12 +2,10 @@
namespace Trinity\Bundle\EditorialBlockBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Trinity\Bundle\EditorialBlockBundle\Configuration\EditorialBlockCrudConfiguration as CrudConfiguration;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\MediaBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\MediaBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
@ -11,8 +10,6 @@ use Trinity\Bundle\MediaBundle\Configuration\MediaCrudConfiguration as CrudConfi
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;
use Trinity\Bundle\ContentManagerBundle\Model\MenuPeer;
use Trinity\Bundle\ContentManagerBundle\Model\NavQuery;
use Trinity\Bundle\MediaBundle\Model\CategoryQuery;
/**
* @Route("/admin/media/item")

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\MediaBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\MediaBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

View file

@ -5,7 +5,6 @@ namespace Trinity\Bundle\MediaBundle\Form\Type;
use Propel\PropelBundle\Form\BaseAbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Trinity\Component\Form\EventListener\FileDeleteFormListener;
use Trinity\Bundle\MediaBundle\Model\TypePeer;
use Trinity\Component\Form\DataTransformer\StringToFileTransformer;
class TypeType extends BaseAbstractType

View file

@ -2,14 +2,11 @@
namespace Trinity\Bundle\NewsletterBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\NewsletterBundle\Configuration\ModelCrudConfiguration as CrudConfiguration;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;
use Trinity\Bundle\UserBundle\Flash\FlashError;

View file

@ -2,7 +2,6 @@
namespace Trinity\Bundle\NewsletterBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

View file

@ -1,122 +1,121 @@
<?php
namespace Trinity\Bundle\NewsletterBundle\Controller;
namespace Trinity\Bundle\NewsletterBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use FOS\UserBundle\Propel\UserQuery;
use FOS\UserBundle\Propel\GroupQuery;
use FOS\UserBundle\Propel\User;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use FOS\UserBundle\Propel\UserQuery;
use FOS\UserBundle\Propel\GroupQuery;
use FOS\UserBundle\Propel\User;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Constraints\NotBlank;
use Symfony\Component\Validator\Constraints\NotEqualTo;
class NewsletterController extends Controller
{
/**
* @Route("/newsletter/show/{id}", name="newsletter_preview")
* @Template()
* @ParamConverter("object", class="Trinity\Bundle\NewsletterBundle\Model\Newsletter")
*/
public function indexAction($object)
{
if (!$object->getModel()) {
throw $this->createNotFoundException('This newsletter does not have a defined template.');
}
class NewsletterController extends Controller
{
/**
* @Route("/newsletter/show/{id}", name="newsletter_preview")
* @Template()
* @ParamConverter("object", class="Trinity\Bundle\NewsletterBundle\Model\Newsletter")
*/
public function indexAction($object)
{
if (!$object->getModel()) {
throw $this->createNotFoundException('This newsletter does not have a defined template.');
}
$blocks = array();
$blocks = array();
foreach ($object->getModel()->getBlocks() as $block) {
$blocks[$block->getName()] = $block;
}
foreach ($object->getModel()->getBlocks() as $block) {
$blocks[$block->getName()] = $block;
}
$user = new User();
$user->setUnsubscribeToken('show');
$user = new User();
$user->setUnsubscribeToken('show');
return $this->render(
$object->getModel()->getTemplate(),
array(
'model' => $object->getModel() ,
'blocks' => $blocks ,
'user' => $user,
)
);
}
return $this->render(
$object->getModel()->getTemplate(),
array(
'model' => $object->getModel() ,
'blocks' => $blocks ,
'user' => $user,
)
);
}
/**
* @Route("/newsletter/subscribe", name="newsletter_subscribe")
* @Template()
*
*/
public function subscribeAction(Request $request)
{
$defaultData = array(
'email' => ($this->getUser())?$this->getUser()->getEmail():null,
);
/**
* @Route("/newsletter/subscribe", name="newsletter_subscribe")
* @Template()
*
*/
public function subscribeAction(Request $request)
{
$defaultData = array(
'email' => ($this->getUser())?$this->getUser()->getEmail():null,
);
// TODO : use DataTransformer and specific Type to manage this
$form = $this->container->get('form.factory')->createNamedBuilder('newsletter_subscribe','form', $defaultData)
->setMethod('POST')
->setAction($this->generateUrl('newsletter_subscribe'))
->add('email', 'email', array(
'attr' => array(
'placeholder' => ($this->getUser())?$this->getUser()->getEmail():$this->get('translator')->trans('mail@example.com')
),
'constraints' => array(
new NotBlank(),
new NotEqualTo(array('value'=> $this->get('translator')->trans('mail@example.com')))
)
))
->add('referer','hidden')
->getForm();
$form->handleRequest($request);
// TODO : use DataTransformer and specific Type to manage this
$form = $this->container->get('form.factory')->createNamedBuilder('newsletter_subscribe','form', $defaultData)
->setMethod('POST')
->setAction($this->generateUrl('newsletter_subscribe'))
->add('email', 'email', array(
'attr' => array(
'placeholder' => ($this->getUser())?$this->getUser()->getEmail():$this->get('translator')->trans('mail@example.com')
),
'constraints' => array(
new NotBlank(),
new NotEqualTo(array('value'=> $this->get('translator')->trans('mail@example.com')))
)
))
->add('referer','hidden')
->getForm();
$form->handleRequest($request);
if($request->isMethod('POST')) {
if ($form->isValid()) {
$datas = $form->getData();
$this->save(array_merge($datas,array('newsletter' => true)));
$request->getSession()->getFlashBag()->add('success',$this->get('translator')->trans('Thank you for your subscription to our newsletter.'));
$this->redirect($this->generateUrl("newsletter_subscribe"));
}
}
if ($request->isMethod('POST')) {
if ($form->isValid()) {
$datas = $form->getData();
$this->save(array_merge($datas,array('newsletter' => true)));
$request->getSession()->getFlashBag()->add('success',$this->get('translator')->trans('Thank you for your subscription to our newsletter.'));
$this->redirect($this->generateUrl("newsletter_subscribe"));
}
}
return $this->render(
'TrinityNewsletterBundle:Newsletter:subscribe.html.twig',
array(
'form' => $form->createView()
)
);
}
return $this->render(
'TrinityNewsletterBundle:Newsletter:subscribe.html.twig',
array(
'form' => $form->createView()
)
);
}
/**
* @Route("/newsletter/unsubscribe/{token}", name="newsletter_unsubscribe")
* @Template()
*/
public function unsubscribeAction($token)
{
$user = UserQuery::create()->filterByUnsubscribeToken($token)->findOne();
/**
* @Route("/newsletter/unsubscribe/{token}", name="newsletter_unsubscribe")
* @Template()
*/
public function unsubscribeAction($token)
{
$user = UserQuery::create()->filterByUnsubscribeToken($token)->findOne();
if (!$user) {
throw $this->createNotFoundException('No user found for this token');
}
if (!$user) {
throw $this->createNotFoundException('No user found for this token');
}
$blck_group = GroupQuery::create()->filterByCode('BLACKLIST')->findOne();
$blck_group = GroupQuery::create()->filterByCode('BLACKLIST')->findOne();
if (!$blck_group) {
throw $this->createNotFoundException('You must define a group with "BLACKLIST" code in order to allow user\'s unsubscribe');
}
if (!$blck_group) {
throw $this->createNotFoundException('You must define a group with "BLACKLIST" code in order to allow user\'s unsubscribe');
}
$user->addGroup($blck_group)->save();
}
$user->addGroup($blck_group)->save();
}
protected function save(array $datas)
{
$this->get('trinity.user_register')->setCurrentUser($this->getUser());
protected function save(array $datas)
{
$this->get('trinity.user_register')->setCurrentUser($this->getUser());
$user = $this->get('trinity.user_register')->registerUserIfUnknown($datas);
$user = $this->get('trinity.user_register')->updateOptins($datas, $user);
}
}
$user = $this->get('trinity.user_register')->registerUserIfUnknown($datas);
$user = $this->get('trinity.user_register')->updateOptins($datas, $user);
}
}

View file

@ -4,7 +4,6 @@ namespace Trinity\Bundle\NewsletterBundle\Form\Type;
use Propel\PropelBundle\Form\BaseAbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use \Trinity\Bundle\NewsletterBundle\Model\ModelQuery;
class NewsletterType extends BaseAbstractType
{

View file

@ -2,16 +2,12 @@
namespace Trinity\Bundle\NotificationBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\NotificationBundle\Configuration\NotificationCrudConfiguration as CrudConfiguration;
/**

View file

@ -2,16 +2,12 @@
namespace Trinity\Bundle\NotificationBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\NotificationBundle\Configuration\TemplateCrudConfiguration as CrudConfiguration;
/**

View file

@ -4,7 +4,6 @@ namespace Trinity\Bundle\NotificationBundle\Form\Type;
use Propel\PropelBundle\Form\BaseAbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Propel\PropelBundle\Validator\Constraints\UniqueObject;
use Symfony\Component\Validator\Constraints\NotBlank;
class TemplateType extends BaseAbstractType

View file

@ -2,12 +2,8 @@
namespace Trinity\Bundle\SearchBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\ContentManagerBundle\Controller\PageController;
use Trinity\Bundle\SearchBundle\Model\SearchObject;
use Trinity\Bundle\ContentManagerBundle\Model\PageQuery;
use Zend\Search\Lucene\Index\Term;
use Zend\Search\Lucene\Search\Query\Boolean as ZendBooleanQuery;

View file

@ -5,7 +5,6 @@ use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Trinity\Bundle\SearchBundle\Event\LuceneEvent;
use Trinity\Bundle\SearchBundle\TrinitySearchEvents;
use ZendSearch\Lucene\Document;
class LuceneSubscriber implements EventSubscriberInterface
{

View file

@ -2,14 +2,11 @@
namespace Trinity\Bundle\UserBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\UserBundle\Configuration\GroupCrudConfiguration as CrudConfiguration;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;

View file

@ -2,14 +2,11 @@
namespace Trinity\Bundle\UserBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\UserBundle\Configuration\UserCrudConfiguration as CrudConfiguration;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;
use Trinity\Bundle\UserBundle\Flash\FlashError;

View file

@ -2,16 +2,12 @@
namespace Trinity\Bundle\UserBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Trinity\Bundle\AdminBundle\Controller\BaseAdminController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Trinity\Bundle\UserBundle\Configuration\UserLogCrudConfiguration as CrudConfiguration;
use Trinity\Bundle\UserBundle\Form\Type\UserLogBatchType as BatchType;

View file

@ -4,7 +4,6 @@ namespace Trinity\Bundle\UserBundle\User;
use FOS\UserBundle\Propel\GroupQuery;
use FOS\UserBundle\Propel\UserGroupPeer;
use FOS\UserBundle\Propel\UserGroupQuery;
use FOS\UserBundle\Propel\UserQuery;
use FOS\UserBundle\Propel\UserPeer;
use FOS\UserBundle\Propel\User;