Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Add Sonata management for managers
Browse files Browse the repository at this point in the history
  • Loading branch information
halfa committed Jan 20, 2016
1 parent b025313 commit 7046d98
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/InsaLan/TournamentBundle/Admin/ManagerAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace InsaLan\TournamentBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;

class ManagerAdmin extends Admin
{
// Fields to be shown on create/edit forms
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('user')
->add('gameName')
->add('tournament')
->add('participant')
->add('paymentDone', null, array('required'=>false))
->add('arrived', null, array('required'=>false))
;
}

// Fields to be shown on filter forms
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('gameName')
->add('user.username')
->add('user.email')
->add('tournament')
->add('arrived')
;
}

// Fields to be shown on lists
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('user.username')
->addIdentifier('gameName')
->add('tournament')
->add('user.email')
->add('paymentDone')
->add('arrived')
;
}

}
1 change: 1 addition & 0 deletions src/InsaLan/TournamentBundle/Admin/PlayerAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ protected function configureFormFields(FormMapper $formMapper)
$formMapper
->add('user')
->add('team')
->add('manager')
->add('gameName')
->add('gameValidated', null, array('required'=>false))
->add('gameAvatar')
Expand Down
1 change: 1 addition & 0 deletions src/InsaLan/TournamentBundle/Admin/TeamAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ protected function configureFormFields(FormMapper $formMapper)
->add('name')
->add('tournament')
->add('captain')
->add('manager')
->add('validated', 'choice', array(
'required' => true,
'choices' => array(
Expand Down
11 changes: 11 additions & 0 deletions src/InsaLan/TournamentBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ services:
calls:
- [ setTranslationDomain, [InsaLanTournamentBundle]]

sonata.admin.tournament.manager:
class: InsaLan\TournamentBundle\Admin\ManagerAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Tournois", label: "Manager" }
arguments:
- ~
- InsaLan\TournamentBundle\Entity\Manager
- ~
calls:
- [ setTranslationDomain, [InsaLanTournamentBundle]]

sonata.admin.tournament.team:
class: InsaLan\TournamentBundle\Admin\TeamAdmin
tags:
Expand Down

0 comments on commit 7046d98

Please sign in to comment.