Skip to content

Commit

Permalink
codestyle update
Browse files Browse the repository at this point in the history
  • Loading branch information
kokspflanze committed Oct 25, 2015
1 parent 9f38548 commit 80eac75
Show file tree
Hide file tree
Showing 27 changed files with 463 additions and 457 deletions.
154 changes: 77 additions & 77 deletions config/module.config.php
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
<?php

return [
'router' => [
'routes' => [
'zfc-ticketsystem' => [
'type' => 'segment',
'options' => [
'route' => '/panel/ticket[-:action[-:id]].html',
'constraints' => [
'action' => '[a-zA-Z-]+',
'id' => '[0-9]+',
],
'defaults' => [
'controller' => 'ZfcTicketSystem\Controller\TicketSystem',
'action' => 'index',
],
],
],
'zfc-ticketsystem-admin' => [
'type' => 'segment',
'options' => [
'route' => '/admin/ticket[-:action[-:id]][-:type].html',
'constraints' => [
'action' => '[a-zA-Z-]+',
'id' => '[0-9]+',
'type' => '[0-9]+',
],
'defaults' => [
'controller' => 'ZfcTicketSystem\Controller\Admin',
'action' => 'index',
],
],
],
],
],
'service_manager' => [
'invokables' => array(
'zfcticketsystem_ticketsystem_service' => 'ZfcTicketSystem\Service\TicketSystem',
'zfcticketsystem_category_service' => 'ZfcTicketSystem\Service\Category',
),
],
'controllers' => [
'invokables' => [
'ZfcTicketSystem\Controller\TicketSystem' => 'ZfcTicketSystem\Controller\TicketSystemController',
'ZfcTicketSystem\Controller\Admin' => 'ZfcTicketSystem\Controller\AdminController',
],
],
'doctrine' => [
'driver' => [
'application_entities' => [
'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => [__DIR__ . '/../src/ZfcTicketSystem/Entity']
],
'orm_default' => [
'drivers' => [
'ZfcTicketSystem\Entity' => 'application_entities'
],
],
],
],
'view_manager' => [
'template_map' => [
'zfc-ticket-system/new' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/new.phtml',
'zfc-ticket-system/view' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/view.phtml',
'zfc-ticket-system/index' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/index.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
'zfc-ticket-system' => [
'auth_service' => 'user_auth_service',
'entity' => [
'ticket_category' => 'ZfcTicketSystem\Entity\TicketCategory',
'ticket_entry' => 'ZfcTicketSystem\Entity\TicketEntry',
'ticket_subject' => 'ZfcTicketSystem\Entity\TicketSubject',
'router' => [
'routes' => [
'zfc-ticketsystem' => [
'type' => 'segment',
'options' => [
'route' => '/panel/ticket[-:action[-:id]].html',
'constraints' => [
'action' => '[a-zA-Z-]+',
'id' => '[0-9]+',
],
'defaults' => [
'controller' => 'ZfcTicketSystem\Controller\TicketSystem',
'action' => 'index',
],
],
],
'zfc-ticketsystem-admin' => [
'type' => 'segment',
'options' => [
'route' => '/admin/ticket[-:action[-:id]][-:type].html',
'constraints' => [
'action' => '[a-zA-Z-]+',
'id' => '[0-9]+',
'type' => '[0-9]+',
],
'defaults' => [
'controller' => 'ZfcTicketSystem\Controller\Admin',
'action' => 'index',
],
],
],
],
],
'service_manager' => [
'invokables' => array(
'zfcticketsystem_ticketsystem_service' => 'ZfcTicketSystem\Service\TicketSystem',
'zfcticketsystem_category_service' => 'ZfcTicketSystem\Service\Category',
),
],
'controllers' => [
'invokables' => [
'ZfcTicketSystem\Controller\TicketSystem' => 'ZfcTicketSystem\Controller\TicketSystemController',
'ZfcTicketSystem\Controller\Admin' => 'ZfcTicketSystem\Controller\AdminController',
],
],
'doctrine' => [
'driver' => [
'application_entities' => [
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => [__DIR__ . '/../src/ZfcTicketSystem/Entity']
],
'orm_default' => [
'drivers' => [
'ZfcTicketSystem\Entity' => 'application_entities'
],
],
],
],
'view_manager' => [
'template_map' => [
'zfc-ticket-system/new' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/new.phtml',
'zfc-ticket-system/view' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/view.phtml',
'zfc-ticket-system/index' => __DIR__ . '/../view/zfc-ticket-system/ticket-system/index.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
'zfc-ticket-system' => [
'auth_service' => 'user_auth_service',
'entity' => [
'ticket_category' => 'ZfcTicketSystem\Entity\TicketCategory',
'ticket_entry' => 'ZfcTicketSystem\Entity\TicketEntry',
'ticket_subject' => 'ZfcTicketSystem\Entity\TicketSubject',
'user' => 'SmallUser\Entity\User'
],
],
],
],
];
18 changes: 9 additions & 9 deletions src/ZfcTicketSystem/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AdminController extends BaseController
*/
public function indexAction()
{
$type = $this->params()->fromRoute( 'type' );
$type = $this->params()->fromRoute('type');

return [
'ticketList' => $this->getTicketService()->getTickets4Type($type)
Expand All @@ -23,11 +23,11 @@ public function indexAction()
*/
public function viewAction()
{
$ticketId = $this->params()->fromRoute( 'id' );
$ticketId = $this->params()->fromRoute('id');
$ticketSubject = $this->getTicketService()->getTicketSubject4Admin($ticketId);
// Fallback if not task
if (!$ticketSubject) {
return $this->redirect()->toRoute( 'zfc-ticketsystem-admin', ['type' => TicketSubject::TYPE_NEW] );
return $this->redirect()->toRoute('zfc-ticketsystem-admin', ['type' => TicketSubject::TYPE_NEW]);
}

$form = $this->getTicketService()->getTicketSystemEntryForm();
Expand All @@ -36,24 +36,24 @@ public function viewAction()
$request = $this->getRequest();

if ($request->isPost()) {
$ticketSubject->setType( TicketSubject::TYPE_OPEN );
$ticketSubject->setType(TicketSubject::TYPE_OPEN);
$ticketSystem = $this->getTicketService()->newEntry(
$this->params()->fromPost(),
$this->getAuthService()->getIdentity(),
$ticketSubject
);

if ($ticketSystem) {
return $this->redirect()->toRoute( 'zfc-ticketsystem-admin', ['id' => $ticketId, 'action' => 'view'] );
return $this->redirect()->toRoute('zfc-ticketsystem-admin', ['id' => $ticketId, 'action' => 'view']);
}
}

$entry = $ticketSubject->getTicketEntry();

return [
'form' => $form,
'form' => $form,
'ticket' => $ticketSubject,
'entry' => $entry
'entry' => $entry
];
}

Expand All @@ -62,14 +62,14 @@ public function viewAction()
*/
public function closeTicketAction()
{
$ticketId = $this->params()->fromRoute( 'id' );
$ticketId = $this->params()->fromRoute('id');
$ticketSubject = $this->getTicketService()->getTicketSubject4Admin($ticketId);

if ($ticketSubject) {
$this->getTicketService()->closeTicket($ticketSubject);
}

return $this->redirect()->toRoute( 'zfc-ticketsystem-admin', ['type' => TicketSubject::TYPE_NEW] );
return $this->redirect()->toRoute('zfc-ticketsystem-admin', ['type' => TicketSubject::TYPE_NEW]);
}

}
6 changes: 3 additions & 3 deletions src/ZfcTicketSystem/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BaseController extends AbstractActionController
protected function getTicketService()
{
if (!$this->ticketService) {
$this->ticketService = $this->getServiceLocator()->get( 'zfcticketsystem_ticketsystem_service' );
$this->ticketService = $this->getServiceLocator()->get('zfcticketsystem_ticketsystem_service');
}

return $this->ticketService;
Expand All @@ -29,8 +29,8 @@ protected function getTicketService()
protected function getAuthService()
{
if (!$this->authService) {
$config = $this->getServiceLocator()->get( 'Config' );
$this->authService = $this->getServiceLocator()->get( $config['zfc-ticket-system']['auth_service'] );
$config = $this->getServiceLocator()->get('Config');
$this->authService = $this->getServiceLocator()->get($config['zfc-ticket-system']['auth_service']);
}

return $this->authService;
Expand Down
39 changes: 20 additions & 19 deletions src/ZfcTicketSystem/Controller/TicketSystemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class TicketSystemController extends BaseController
*/
public function indexAction()
{
$view = new ViewModel( [
'ticketList' => $this->getTicketService()->getTickets4User( $this->getLoggedInUserId() )
$view = new ViewModel([
'ticketList' => $this->getTicketService()->getTickets4User($this->getLoggedInUserId())
]);
$view->setTemplate( 'zfc-ticket-system/index' );
$view->setTemplate('zfc-ticket-system/index');

return $view;
}
Expand All @@ -31,13 +31,14 @@ public function newAction()
/** @var \Zend\Http\Request $request */
$request = $this->getRequest();
if ($request->isPost()) {
$ticketSystem = $this->getTicketService()->newTicket( $this->params()->fromPost(), $this->getAuthService()->getIdentity() );
$ticketSystem = $this->getTicketService()->newTicket($this->params()->fromPost(),
$this->getAuthService()->getIdentity());
if ($ticketSystem) {
return $this->redirect()->toRoute( 'zfc-ticketsystem' );
return $this->redirect()->toRoute('zfc-ticketsystem');
}
}
$view = new ViewModel( ['form' => $form] );
$view->setTemplate( 'zfc-ticket-system/new' );
$view = new ViewModel(['form' => $form]);
$view->setTemplate('zfc-ticket-system/new');

return $view;
}
Expand All @@ -47,11 +48,11 @@ public function newAction()
*/
public function viewAction()
{
$ticketId = $this->params()->fromRoute( 'id' );
$ticketSubject = $this->getTicketService()->getTicketSubject( $this->getLoggedInUserId(), $ticketId );
$ticketId = $this->params()->fromRoute('id');
$ticketSubject = $this->getTicketService()->getTicketSubject($this->getLoggedInUserId(), $ticketId);
// Fallback if no task
if (!$ticketSubject) {
return $this->redirect()->toRoute( 'zfc-ticketsystem' );
return $this->redirect()->toRoute('zfc-ticketsystem');
}

$form = $this->getTicketService()->getTicketSystemEntryForm();
Expand All @@ -60,26 +61,26 @@ public function viewAction()
$request = $this->getRequest();

if ($request->isPost()) {
$ticketSubject->setType( TicketSubject::TYPE_NEW );
$ticketSubject->setType(TicketSubject::TYPE_NEW);
$ticketSystem = $this->getTicketService()->newEntry(
$this->params()->fromPost(),
$this->getAuthService()->getIdentity(),
$ticketSubject
);

if ($ticketSystem) {
return $this->redirect()->toRoute( 'zfc-ticketsystem', ['id' => $ticketId, 'action' => 'view'] );
return $this->redirect()->toRoute('zfc-ticketsystem', ['id' => $ticketId, 'action' => 'view']);
}
}

$entry = $ticketSubject->getTicketEntry();

$view = new ViewModel( [
'form' => $form,
$view = new ViewModel([
'form' => $form,
'ticket' => $ticketSubject,
'entry' => $entry
'entry' => $entry
]);
$view->setTemplate( 'zfc-ticket-system/view' );
$view->setTemplate('zfc-ticket-system/view');

return $view;
}
Expand All @@ -89,14 +90,14 @@ public function viewAction()
*/
public function closeTicketAction()
{
$ticketId = $this->params()->fromRoute( 'id' );
$ticketSubject = $this->getTicketService()->getTicketSubject( $this->getLoggedInUserId(), $ticketId );
$ticketId = $this->params()->fromRoute('id');
$ticketSubject = $this->getTicketService()->getTicketSubject($this->getLoggedInUserId(), $ticketId);

if ($ticketSubject) {
$this->getTicketService()->closeTicket($ticketSubject);
}

return $this->redirect()->toRoute( 'zfc-ticketsystem' );
return $this->redirect()->toRoute('zfc-ticketsystem');
}

/**
Expand Down
28 changes: 14 additions & 14 deletions src/ZfcTicketSystem/Entity/Repository/TicketCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@

class TicketCategory extends EntityRepository
{
/**
* @return \ZfcTicketSystem\Entity\TicketCategory[]
*/
public function getActiveCategory()
/**
* @return \ZfcTicketSystem\Entity\TicketCategory[]
*/
public function getActiveCategory()
{
$query = $this->createQueryBuilder('p')
->select('p')
->where('p.active = :active')
->setParameter('active', '1')
->orderBy('p.sortKey','asc')
->getQuery();
$query = $this->createQueryBuilder('p')
->select('p')
->where('p.active = :active')
->setParameter('active', '1')
->orderBy('p.sortKey', 'asc')
->getQuery();

return $query->getResult();
}
return $query->getResult();
}

/**
* @param $id
* @return \ZfcTicketSystem\Entity\TicketCategory|null
*/
public function getCategory( $id )
public function getCategory($id)
{
$query = $this->createQueryBuilder('p')
->select('p')
Expand All @@ -51,7 +51,7 @@ public function getQueryBuilder()
* @param $categoryId
* @return null|\ZfcTicketSystem\Entity\TicketCategory
*/
public function getCategory4Id( $categoryId )
public function getCategory4Id($categoryId)
{
$query = $this->createQueryBuilder('p')
->select('p')
Expand Down
Loading

0 comments on commit 80eac75

Please sign in to comment.