-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
692 additions
and
175 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,42 @@ | ||
<?php | ||
|
||
$header = <<<'HEADER' | ||
This file is part of HackzillaTicketBundle package. | ||
(c) Daniel Platt <[email protected]> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
HEADER; | ||
|
||
// Use PHP-CS-Fixer 2+ if it is available | ||
if (\class_exists(PhpCsFixer\Config::class, false)) { | ||
return PhpCsFixer\Config::create() | ||
->setUsingCache(true) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'binary_operator_spaces' => [ | ||
'align_double_arrow' => true, | ||
'align_equals' => true, | ||
], | ||
'blank_line_after_opening_tag' => true, | ||
'combine_consecutive_issets' => true, | ||
'combine_consecutive_unsets' => true, | ||
'explicit_string_variable' => true, | ||
'global_namespace_import' => ['import_classes' => false], | ||
'header_comment' => [ | ||
'header' => $header, | ||
], | ||
'logical_operators' => true, | ||
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], | ||
'multiline_whitespace_before_semicolons' => true, | ||
'no_alternative_syntax' => true, | ||
'no_extra_blank_lines' => true, | ||
'no_null_property_initialization' => true, | ||
'no_php4_constructor' => true, | ||
'no_short_echo_tag' => true, | ||
'no_superfluous_elseif' => true, | ||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], | ||
'no_unset_on_property' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'ordered_class_elements' => true, | ||
|
@@ -28,6 +45,8 @@ if (\class_exists(PhpCsFixer\Config::class, false)) { | |
'php_unit_set_up_tear_down_visibility' => true, | ||
'php_unit_strict' => true, | ||
'phpdoc_order' => true, | ||
'single_line_throw' => false, | ||
'static_lambda' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create()->exclude(['Tests/Functional/cache'])->in(__DIR__) | ||
|
@@ -38,13 +57,11 @@ if (\class_exists(PhpCsFixer\Config::class, false)) { | |
return Symfony\CS\Config\Config::create() | ||
->setUsingCache(true) | ||
->fixers([ | ||
'align_double_arrow', | ||
'header_comment' => $header, | ||
'newline_after_open_tag', | ||
'ordered_use', | ||
'php_unit_construct', | ||
'short_array_syntax', | ||
'-unalign_double_arrow', | ||
'-unalign_equals', | ||
]) | ||
->finder( | ||
Symfony\CS\Finder\DefaultFinder::create() | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of HackzillaTicketBundle package. | ||
* | ||
* (c) Daniel Platt <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hackzilla\Bundle\TicketBundle\Command; | ||
|
||
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessage; | ||
|
@@ -35,8 +44,7 @@ protected function configure() | |
InputOption::VALUE_OPTIONAL, | ||
'How many days since the ticket was resolved?', | ||
'10' | ||
) | ||
; | ||
); | ||
} | ||
|
||
/** | ||
|
@@ -48,11 +56,11 @@ protected function execute(InputInterface $input, OutputInterface $output) | |
throw new \RuntimeException(sprintf('Command "%s" requires the service "fos_user.user_manager". Is "friendsofsymfony/user-bundle" installed and enabled?', $this->getName())); | ||
} | ||
|
||
$ticketManager = $this->getContainer()->get('hackzilla_ticket.ticket_manager'); | ||
$userManager = $this->getContainer()->get('fos_user.user_manager'); | ||
$ticketManager = $this->getContainer()->get('hackzilla_ticket.ticket_manager'); | ||
$userManager = $this->getContainer()->get('fos_user.user_manager'); | ||
$ticketRepository = $this->getContainer()->get('doctrine')->getRepository('HackzillaTicketBundle:Ticket'); | ||
|
||
$locale = $this->getContainer()->getParameter('locale') ? $this->getContainer()->getParameter('locale') : 'en'; | ||
$locale = $this->getContainer()->getParameter('locale') ? $this->getContainer()->getParameter('locale') : 'en'; | ||
$translator = $this->getContainer()->get('translator'); | ||
$translator->setLocale($locale); | ||
|
||
|
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of HackzillaTicketBundle package. | ||
* | ||
* (c) Daniel Platt <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hackzilla\Bundle\TicketBundle\Command; | ||
|
||
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessage; | ||
|
@@ -40,8 +49,7 @@ protected function configure() | |
InputOption::VALUE_OPTIONAL, | ||
'What priority would it be?', | ||
'21' | ||
) | ||
; | ||
); | ||
} | ||
|
||
/** | ||
|
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of HackzillaTicketBundle package. | ||
* | ||
* (c) Daniel Platt <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hackzilla\Bundle\TicketBundle\Component; | ||
|
||
use Hackzilla\Bundle\TicketBundle\Model\TicketFeature\MessageAttachmentInterface; | ||
|
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of HackzillaTicketBundle package. | ||
* | ||
* (c) Daniel Platt <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hackzilla\Bundle\TicketBundle\Controller; | ||
|
||
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment; | ||
|
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of HackzillaTicketBundle package. | ||
* | ||
* (c) Daniel Platt <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hackzilla\Bundle\TicketBundle\Controller; | ||
|
||
use Hackzilla\Bundle\TicketBundle\Event\TicketEvent; | ||
|
@@ -27,12 +36,12 @@ class TicketController extends Controller | |
*/ | ||
public function indexAction(Request $request) | ||
{ | ||
$userManager = $this->getUserManager(); | ||
$userManager = $this->getUserManager(); | ||
$ticketManager = $this->get('hackzilla_ticket.ticket_manager'); | ||
|
||
$translationDomain = $this->getParameter('hackzilla_ticket.translation_domain'); | ||
|
||
$ticketState = $request->get('state', $this->get('translator')->trans('STATUS_OPEN', [], $translationDomain)); | ||
$ticketState = $request->get('state', $this->get('translator')->trans('STATUS_OPEN', [], $translationDomain)); | ||
$ticketPriority = $request->get('priority', null); | ||
|
||
$query = $ticketManager->getTicketListQuery( | ||
|
@@ -50,9 +59,9 @@ public function indexAction(Request $request) | |
return $this->render( | ||
$this->container->getParameter('hackzilla_ticket.templates')['index'], | ||
[ | ||
'pagination' => $pagination, | ||
'ticketState' => $ticketState, | ||
'ticketPriority' => $ticketPriority, | ||
'pagination' => $pagination, | ||
'ticketState' => $ticketState, | ||
'ticketPriority' => $ticketPriority, | ||
'translationDomain' => $translationDomain, | ||
] | ||
); | ||
|
@@ -68,7 +77,7 @@ public function createAction(Request $request) | |
$ticketManager = $this->get('hackzilla_ticket.ticket_manager'); | ||
|
||
$ticket = $ticketManager->createTicket(); | ||
$form = $this->createForm(TicketType::class, $ticket); | ||
$form = $this->createForm(TicketType::class, $ticket); | ||
$form->handleRequest($request); | ||
|
||
if ($form->isValid()) { | ||
|
@@ -87,8 +96,8 @@ public function createAction(Request $request) | |
return $this->render( | ||
$this->container->getParameter('hackzilla_ticket.templates')['new'], | ||
[ | ||
'entity' => $ticket, | ||
'form' => $form->createView(), | ||
'entity' => $ticket, | ||
'form' => $form->createView(), | ||
'translationDomain' => $translationDomain, | ||
] | ||
); | ||
|
@@ -100,7 +109,7 @@ public function createAction(Request $request) | |
public function newAction() | ||
{ | ||
$ticketManager = $this->get('hackzilla_ticket.ticket_manager'); | ||
$entity = $ticketManager->createTicket(); | ||
$entity = $ticketManager->createTicket(); | ||
|
||
$form = $this->createForm(TicketType::class, $entity); | ||
|
||
|
@@ -109,8 +118,8 @@ public function newAction() | |
return $this->render( | ||
$this->container->getParameter('hackzilla_ticket.templates')['new'], | ||
[ | ||
'entity' => $entity, | ||
'form' => $form->createView(), | ||
'entity' => $entity, | ||
'form' => $form->createView(), | ||
'translationDomain' => $translationDomain, | ||
] | ||
); | ||
|
@@ -126,7 +135,7 @@ public function newAction() | |
public function showAction($ticketId) | ||
{ | ||
$ticketManager = $this->get('hackzilla_ticket.ticket_manager'); | ||
$ticket = $ticketManager->getTicketById($ticketId); | ||
$ticket = $ticketManager->getTicketById($ticketId); | ||
|
||
if (!$ticket) { | ||
return $this->redirect($this->generateUrl('hackzilla_ticket')); | ||
|
@@ -162,7 +171,7 @@ public function showAction($ticketId) | |
public function replyAction(Request $request, $ticketId) | ||
{ | ||
$ticketManager = $this->get('hackzilla_ticket.ticket_manager'); | ||
$ticket = $ticketManager->getTicketById($ticketId); | ||
$ticket = $ticketManager->getTicketById($ticketId); | ||
|
||
$translationDomain = $this->getParameter('hackzilla_ticket.translation_domain'); | ||
|
||
|
@@ -205,7 +214,7 @@ public function replyAction(Request $request, $ticketId) | |
public function deleteAction(Request $request, $ticketId) | ||
{ | ||
$userManager = $this->getUserManager(); | ||
$user = $userManager->getCurrentUser(); | ||
$user = $userManager->getCurrentUser(); | ||
|
||
if (!\is_object($user) || !$userManager->hasRole($user, TicketRole::ADMIN)) { | ||
throw new \Symfony\Component\HttpKernel\Exception\HttpException(403); | ||
|
@@ -218,7 +227,7 @@ public function deleteAction(Request $request, $ticketId) | |
|
||
if ($form->isValid()) { | ||
$ticketManager = $this->get('hackzilla_ticket.ticket_manager'); | ||
$ticket = $ticketManager->getTicketById($ticketId); | ||
$ticket = $ticketManager->getTicketById($ticketId); | ||
|
||
if (!$ticket) { | ||
$translationDomain = $this->getParameter('hackzilla_ticket.translation_domain'); | ||
|
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 |
---|---|---|
@@ -1,8 +1,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of HackzillaTicketBundle package. | ||
* | ||
* (c) Daniel Platt <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hackzilla\Bundle\TicketBundle\DependencyInjection\Compiler; | ||
|
||
use Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator; | ||
use Doctrine\ORM\Mapping\Driver\XmlDriver; | ||
use Hackzilla\Bundle\TicketBundle\DependencyInjection\HackzillaTicketExtension; | ||
use Hackzilla\Bundle\TicketBundle\Entity\Ticket; | ||
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessage; | ||
use Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment; | ||
use Hackzilla\Bundle\TicketBundle\Entity\TicketWithAttachment; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Definition; | ||
|
||
|
@@ -19,25 +34,23 @@ public function __construct($driver = null, array $namespaces = [], $managerPara | |
public function process(ContainerBuilder $container) | ||
{ | ||
$bundleDirectory = HackzillaTicketExtension::bundleDirectory(); | ||
$namespaces = []; | ||
$namespaces = []; | ||
|
||
if ( | ||
'Hackzilla\Bundle\TicketBundle\Entity\TicketWithAttachment' === $container->getParameter('hackzilla_ticket.model.ticket.class') | ||
|| | ||
'Hackzilla\Bundle\TicketBundle\Entity\TicketMessageWithAttachment' === $container->getParameter('hackzilla_ticket.model.message.class') | ||
TicketWithAttachment::class === $container->getParameter('hackzilla_ticket.model.ticket.class') || | ||
TicketMessageWithAttachment::class === $container->getParameter('hackzilla_ticket.model.message.class') | ||
) { | ||
$namespaces[realpath($bundleDirectory.'/Resources/config/doctrine/model/attachment')] = 'Hackzilla\Bundle\TicketBundle\Entity'; | ||
} elseif ( | ||
'Hackzilla\Bundle\TicketBundle\Entity\Ticket' === $container->getParameter('hackzilla_ticket.model.ticket.class') | ||
|| | ||
'Hackzilla\Bundle\TicketBundle\Entity\TicketMessage' === $container->getParameter('hackzilla_ticket.model.message.class') | ||
Ticket::class === $container->getParameter('hackzilla_ticket.model.ticket.class') || | ||
TicketMessage::class === $container->getParameter('hackzilla_ticket.model.message.class') | ||
) { | ||
$namespaces[realpath($bundleDirectory.'/Resources/config/doctrine/model/plain')] = 'Hackzilla\Bundle\TicketBundle\Entity'; | ||
} | ||
|
||
$arguments = [$namespaces, '.orm.xml']; | ||
$locator = new Definition('Doctrine\Common\Persistence\Mapping\Driver\SymfonyFileLocator', $arguments); | ||
$this->driver = new Definition('Doctrine\ORM\Mapping\Driver\XmlDriver', [$locator]); | ||
$arguments = [$namespaces, '.orm.xml']; | ||
$locator = new Definition(SymfonyFileLocator::class, $arguments); | ||
$this->driver = new Definition(XmlDriver::class, [$locator]); | ||
$this->namespaces = $namespaces; | ||
|
||
parent::process($container); | ||
|
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of HackzillaTicketBundle package. | ||
* | ||
* (c) Daniel Platt <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Hackzilla\Bundle\TicketBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
|
@@ -54,8 +63,7 @@ public function getConfigTreeBuilder() | |
->scalarNode('macros')->defaultValue('@HackzillaTicket/Macros/macros.html.twig')->end() | ||
->end() | ||
->end() | ||
->end() | ||
; | ||
->end(); | ||
|
||
return $treeBuilder; | ||
} | ||
|
Oops, something went wrong.