2016-07-01 58 views
1

我已經更新了奏鳴曲管理員軟件包到3.1版本。從那時起我再也沒有過濾器了。有人有同樣的問題嗎?版本更新後沒有與奏鳴曲管理員3.1的過濾器

這是我classAdmin:

<?php 
 

 
// src/CD/CarsBundle/Admin/ReservationsAdmin.php 
 
// This code is made to custom the fields in the bloc 'Reservations' in the Admin Interface. 
 

 
namespace CD\CarsBundle\Admin; 
 

 
use Sonata\AdminBundle\Admin\Admin; 
 
use Sonata\AdminBundle\Datagrid\DatagridMapper; 
 
use Sonata\AdminBundle\Datagrid\ListMapper; 
 
use Sonata\AdminBundle\Form\FormMapper; 
 
use Sonata\AdminBundle\Show\ShowMapper; 
 
use Sonata\AdminBundle\Route\RouteCollection; 
 

 
/** 
 
* 
 
*/ 
 
class ReservationsAdmin extends Admin 
 
{ 
 
\t 
 
\t // This code sets up the defaut sort column and order of the informations registered in this category. 
 

 
\t protected $datagridValues = array(
 
\t \t '_sort_order' => 'ASC', 
 
\t \t '_sort_by' => 'id') 
 
\t ; 
 

 
\t // This code configures the filters section on the right side of the 'Réservations' page when we click on 'Liste'. 
 

 
\t /** 
 
\t * @param DatagridMapper $datagridMapper 
 
\t */ 
 
\t protected function configureDatagridFilters(DatagridMapper $datagridMapper) 
 
\t { 
 
\t \t $datagridMapper 
 
\t \t \t ->add('id') 
 
\t \t \t ->add('reserve', null, array('label' => 'Réservé')) 
 
\t \t \t ->add('vehicules', null, array('label' => 'Véhicules - Immatriculation'), 'entity', array(
 
\t \t \t \t 'class' => 'CD\CarsBundle\Entity\Vehicules', 
 
\t \t \t \t 'property' => 'immatriculation' 
 
\t \t \t)) 
 
\t \t \t ->add('heureDebut', null, array(
 
\t \t \t \t 'label' => 'Date et heure de début'), 'sonata_type_datetime_picker', array(
 
    \t \t \t 'format'    => 'dd-MM-yyyy', 
 
    \t \t \t 'dp_side_by_side'  => true, 
 
\t \t \t \t 'dp_use_current'  => false, 
 
    \t \t \t 'dp_use_seconds'  => false, 
 
    \t \t)) 
 
    \t \t ->add('heureFin', null, array(
 
\t \t \t \t 'label' => 'Date et heure de fin'), 'sonata_type_datetime_picker', array(
 
    \t \t \t 'format'    => 'dd-MM-yyyy', 
 
    \t \t \t 'dp_side_by_side'  => true, 
 
\t \t \t \t 'dp_use_current'  => false, 
 
    \t \t \t 'dp_use_seconds'  => false, 
 
    \t \t)) 
 
\t \t \t ->add('nomAgent', null, array('label' => 'Nom de l\'agent')) 
 
\t \t \t ->add('prenomAgent', null, array('label' => 'Prénom de l\'agent')) 
 
\t \t \t ->add('direction', null, array('label' => 'Direction')) 
 
\t \t \t //commented because not needed here ->add('commentaires', null, array('label' => 'Véhicule affecté et commentaires supplémentaires')) 
 
\t \t ; 
 
\t } 
 

 
\t // This code configures the informations listed on the 'Réservations' page when we click on 'liste' 
 

 
\t /** 
 
\t * @param ListMapper $listMapper 
 
\t */ 
 
\t protected function configureListFields(ListMapper $listMapper) 
 
\t { 
 
\t \t $listMapper 
 
\t \t \t ->add('id') 
 
\t \t \t ->add('vehicules', null, array('label' => 'Véhicules - Immatriculation'), 'entity', array(
 
\t \t \t \t 'class' => 'CD\CarsBundle\Entity\Vehicules', 
 
\t \t \t \t 'property' => 'immatriculation' 
 
\t \t \t)) 
 
\t \t \t ->add('heureDebut', null, array('label' => 'Date et heure de début', 'format' => 'd-m-Y H:i')) 
 
\t \t \t ->add('heureFin', null, array('label' => 'Date et heure de fin', 'format' => 'd-m-Y H:i')) 
 
\t \t \t ->add('nomAgent', null, array('label' => 'Nom de l\'agent')) 
 
\t \t \t ->add('prenomAgent', null, array('label' => 'Prénom de l\'agent')) 
 
\t \t \t ->add('direction', null, array('label' => 'Direction')) 
 
\t \t \t ->add('reserve', null, array(
 
\t \t \t \t 'label' => 'Réservé', 
 
\t \t \t \t 'editable' => true 
 
\t \t \t)) 
 
\t \t \t ->add('annulation', null, array(
 
\t \t \t \t 'label' => 'Annulé', 
 
\t \t \t \t 'editable' => true 
 
\t \t \t)) 
 
\t \t \t ->add('remisage', null, array(
 
\t \t \t \t 'label' => 'Remisage', 
 
\t \t \t \t 'required'=> false, 
 
\t \t \t \t 'editable' => true 
 
\t \t \t)) 
 
\t \t \t //commented because not needed here ->add('commentaires', null, array('label' => 'Véhicule affecté et commentaires supplémentaires')) 
 
\t \t \t ->add('_action', 'actions', array(
 
\t \t \t \t 'actions' => array(
 
\t \t \t \t \t 'show' => array(), 
 
\t \t \t \t \t 'edit' => array(), 
 
\t \t \t \t \t 'delete' => array(), 
 
\t \t \t \t \t 'email' => array(
 
\t \t \t \t \t \t 'template' => 'CDCarsBundle:Reservations:list__action_email.html.twig'), 
 
\t \t \t \t) 
 
\t \t \t)) 
 
\t \t ; 
 
\t } 
 

 
\t // This code configures the fieds in the form to add a booking. 
 

 
\t /** 
 
\t * @param FormMapper $formMapper 
 
\t */ 
 
\t protected function configureFormFields(FormMapper $formMapper) 
 
\t { 
 
\t \t $formMapper 
 
\t \t \t ->with('Généralités') 
 
\t \t \t \t ->add('heureDebut', 'date', array(
 
\t \t \t \t \t 'label' => 'Date et heure de début', 
 
\t \t \t \t \t 'format' => 'dd-MM-yyyy H:i', 
 
\t \t \t \t \t 'years' => range(\date("Y") - 0, \date("Y") + 2), 
 
      \t)) 
 
\t \t \t \t ->add('heureFin', 'date', array(
 
\t \t \t \t \t 'label' => 'Date et heure de fin', 
 
\t \t \t \t \t 'format' => 'dd-MM-yyyy H:i', 
 
\t \t \t \t \t 'years' => range(\date("Y") - 0, \date("Y") + 2), 
 
      \t)) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Agent') 
 
\t \t \t \t ->add('nomAgent', null, array('label' => 'Nom de l\'agent')) 
 
\t \t \t \t ->add('prenomAgent', null, array('label' => 'Prénom de l\'agent')) 
 
\t \t \t \t ->add('dga', null, array('label' => 'D.G.A')) 
 
\t \t \t \t ->add('direction', null, array('label' => 'Direction')) 
 
\t \t \t \t ->add('email', null, array('label' => 'Email')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Demande') 
 
\t \t \t \t ->add('besoin', null, array('label' => 'Besoin')) 
 
\t \t \t \t ->add('nombrePersonne', null, array('label' => 'Nombre de personne')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Disponibilité') 
 
\t \t \t \t ->add('reserve', null, array('label' => 'Réservé')) 
 
\t \t \t \t ->add('annulation', null, array('label' => 'Annulé')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Remisage') 
 
\t \t \t \t ->add('remisage', null, array('label' => 'Remisage')) 
 
\t \t \t \t ->add('adresseRemisage', null, array('label' => 'Adresse')) 
 
      \t ->add('dateDebutRemisage', null, array(
 
      \t \t 'label' => 'Du', 
 
      \t \t 'format' => 'dd-MM-yyyy H:i', 
 
\t \t \t \t \t 'years' => range(\date("Y") - 0, \date("Y") + 2), 
 
\t \t \t \t)) 
 
      \t ->add('dateFinRemisage', null, array(
 
      \t \t 'label' => 'au', 
 
      \t \t 'format' => 'dd-MM-yyyy H:i', 
 
\t \t \t \t \t 'years' => range(\date("Y") - 0, \date("Y") + 2), 
 
      \t)) 
 
      \t ->add('emailDirecteur', null, array('label' => 'Email du Directeur')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Destination') 
 
\t \t \t \t ->add('destination', null, array('label' => 'Destination')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Motif') 
 
\t \t \t \t ->add('motifRdv', null, array('label' => 'Rendez-vous')) 
 
\t \t \t \t ->add('motifFormation', null, array('label' => 'Formation')) 
 
\t \t \t \t ->add('motifReunion', null, array('label' => 'Réunion')) 
 
\t \t \t \t ->add('motifCollecte', null, array('label' => 'Collecte')) 
 
\t \t \t \t ->add('motifInstallation', null, array('label' => 'Installation')) 
 
\t \t \t \t ->add('motifProgrammation', null, array('label' => 'Programmation')) 
 
\t \t \t \t ->add('motifDepannage', null, array('label' => 'Dépannage')) 
 
\t \t \t \t ->add('motifVad', null, array('label' => 'Visite à domicile')) 
 
\t \t \t \t ->add('motifAutre', null, array('label' => 'Autre motif')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Conducteur') 
 
\t \t \t \t ->add('conducteur', null, array('label' => 'Conducteur')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Mandataire') 
 
\t \t \t \t ->add('mandataire', null, array('label' => 'Mandataire')) 
 
\t \t \t \t ->add('nomMandataire', null, array('label' => 'Nom du mandataire')) 
 
      \t \t ->add('prenomMandataire', null, array('label' => 'Prénom du mandataire')) 
 
      \t \t ->add('emailMandataire', null, array('label' => 'Email du mandataire')) 
 
      ->end() \t \t 
 
      ->with('Attestation') 
 
\t \t \t \t ->add('honneur', null, array('label' => 'Attestation cochée')) 
 
\t \t \t ->end() \t \t 
 
\t \t \t ->with('Informations supplémentaires') 
 
\t \t \t \t ->add('commentaires', null, array('label' => 'Véhicule affecté et commentaires supplémentaires')) 
 
\t \t \t \t 
 
\t \t \t \t // Added 'choices' to be able to reach the vehiculesrepository to find the needed informations as known as the available vehicles depends on a specific date 
 
\t \t \t \t ->add('vehicules', null, array(
 
\t \t \t \t \t 'label' => 'Véhicules - Immatriculation', 
 
\t \t \t \t \t 'choices' => $this->getVehiculesRepository()->getAvailables($this->getEntity()) 
 
\t \t \t \t), 
 
\t \t \t \t array(
 
\t \t \t \t \t 'class' => 'CD\CarsBundle\Entity\Vehicules', 
 
\t \t \t \t \t 'property' => 'immatriculation' 
 
\t \t \t \t)) 
 
\t \t \t ->end() 
 
\t \t ; 
 
\t } 
 

 
\t // This code configures what is shown on the 'Réservations' page when we click on 'afficher'. 
 

 
\t /** 
 
\t * @param ShowMapper $showMapper 
 
\t */ 
 
\t protected function configureShowFields(ShowMapper $showMapper) 
 
\t { 
 
\t \t $showMapper 
 
\t \t \t ->with('Généralités sur la réservation') 
 
\t \t \t \t ->add('id') 
 
\t \t \t \t ->add('heureDebut', 'date', array(
 
\t \t \t \t \t 'label' => 'Date et heure de début', 
 
\t \t \t \t \t 'format' => 'd-M-y H:i' 
 
\t \t \t \t)) 
 
\t \t \t \t ->add('heureFin', 'date', array(
 
\t \t \t \t \t 'label' => 'Date et heure de fin', 
 
\t \t \t \t \t 'format' => 'd-M-y H:i' 
 
\t \t \t \t)) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Agent') 
 
\t \t \t \t ->add('nomAgent', null, array('label' => 'Nom de l\'agent')) 
 
\t \t \t \t ->add('prenomAgent', null, array('label' => 'Prénom de l\'agent')) 
 
\t \t \t \t ->add('dga', null, array('label' => 'D.G.A')) 
 
\t \t \t \t ->add('direction', null, array('label' => 'Direction')) 
 
\t \t \t \t ->add('email', null, array('label' => 'Email')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Demande') 
 
\t \t \t \t ->add('besoin', null, array('label' => 'Besoin')) 
 
\t \t \t \t ->add('nombrePersonne', null, array('label' => 'Nombre de personne')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Disponibilité') 
 
\t \t \t \t ->add('reserve', null, array('label' => 'Réservé')) 
 
\t \t \t \t ->add('annulation', null, array('label' => 'Annulé')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Remisage') 
 
\t \t \t \t ->add('remisage', null, array('label' => 'Remisage')) 
 
\t \t \t \t ->add('adresseRemisage', null, array('label' => 'Adresse')) 
 
      \t ->add('dateDebutRemisage', null, array(
 
      \t \t 'label' => 'Du', 
 
      \t \t 'format' => 'd-M-y H:i' 
 
      \t)) 
 
      \t ->add('dateFinRemisage', null, array(
 
      \t \t 'label' => 'au', 
 
      \t \t 'format' => 'd-M-y H:i' 
 
      \t)) 
 
      \t ->add('emailDirecteur', null, array('label' => 'Email du Directeur')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Destination') 
 
\t \t \t \t ->add('destination', null, array('label' => 'Destination')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Motif') 
 
\t \t \t \t ->add('motifRdv', null, array('label' => 'Rendez-vous')) 
 
\t \t \t \t ->add('motifFormation', null, array('label' => 'Formation')) 
 
\t \t \t \t ->add('motifReunion', null, array('label' => 'Réunion')) 
 
\t \t \t \t ->add('motifCollecte', null, array('label' => 'Collecte')) 
 
\t \t \t \t ->add('motifInstallation', null, array('label' => 'Installation')) 
 
\t \t \t \t ->add('motifProgrammation', null, array('label' => 'Programmation')) 
 
\t \t \t \t ->add('motifDepannage', null, array('label' => 'Dépannage')) 
 
\t \t \t \t ->add('motifVad', null, array('label' => 'Visite à domicile')) 
 
\t \t \t \t ->add('motifAutre', null, array('label' => 'Autre motif')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Conducteur') 
 
\t \t \t \t ->add('conducteur', null, array('label' => 'Conducteur')) 
 
\t \t \t ->end() 
 
\t \t \t ->with('Mandataire') 
 
\t \t \t \t ->add('mandataire', null, array('label' => 'Mandataire')) 
 
\t \t \t \t ->add('nomMandataire', null, array('label' => 'Nom du mandataire')) 
 
      \t \t ->add('prenomMandataire', null, array('label' => 'Prénom du mandataire')) 
 
      \t \t ->add('emailMandataire', null, array('label' => 'Email du mandataire')) 
 
      ->end() \t 
 
      ->with('Attestation') 
 
\t \t \t \t ->add('honneur', null, array('label' => 'Attestation cochée')) 
 
\t \t \t ->end() \t \t 
 
\t \t \t ->with('Informations supplémentaires') 
 
\t \t \t \t ->add('commentaires', null, array('label' => 'Véhicule affecté et commentaires supplémentaires')) 
 
\t \t \t \t ->add('vehicules', null, array('label' => 'Véhicules - Immatriculation'), array(
 
\t \t \t \t \t 'class' => 'CD\CarsBundle\Entity\Vehicules', 
 
\t \t \t \t \t 'property' => 'immatriculation' 
 
\t \t \t \t)) 
 
\t \t \t ->end() 
 
\t \t \t 
 
\t \t ; 
 
\t } 
 

 
\t // Added a custom action in the listfields = email 
 

 
\t protected function configureRoutes(RouteCollection $collection) 
 
\t { 
 
\t \t $collection->add('email', $this->getRouterIdParameter().'cd_cars_reservations'); 
 
\t } 
 

 
\t // Used to go to pin on the vehiculerepository 
 

 
\t /** 
 
\t * @return \CD\CarsBundle\Entity\VehiculesRepository 
 
\t */ 
 
\t private function getVehiculesRepository() 
 
\t { 
 
\t \t return $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository('CDCarsBundle:Vehicules'); 
 
\t } 
 

 
\t // Used to reach the enity 
 

 
\t private function getEntity() 
 
\t { 
 
\t \t return $this->getRoot()->getSubject(); 
 
\t } 
 

 
\t 
 
}

實體:

# ORM for the "Reservations" entity with fields and mapping between database tables 
 

 
CD\CarsBundle\Entity\Reservations: 
 
    type: entity 
 
    table: null 
 
    repositoryClass: CD\CarsBundle\Entity\ReservationsRepository 
 
    id: 
 
     id: 
 
      type: integer 
 
      id: true 
 
      generator: 
 
       strategy: AUTO 
 
    fields: 
 
     heureDebut: 
 
      type: datetime 
 
     heureFin: 
 
      type: datetime 
 
     nomAgent: 
 
      type: string 
 
      length: 255 
 
     prenomAgent: 
 
      type: string 
 
      length: 255 
 
     dga: 
 
      type: string 
 
      length: 255 
 
      nullable: true 
 
     direction: 
 
      type: string 
 
      length: 255 
 
     email: 
 
      type: string 
 
      length: 255 
 
      nullable: true 
 
     telephone: 
 
      type: string 
 
      length: 255 
 
      nullable: true 
 
     destination: 
 
      type: text 
 
     reserve: 
 
      type: boolean 
 
      nullable: true 
 
     annulation: 
 
      type: boolean 
 
      nullable: true 
 
     remisage: 
 
      type: boolean 
 
      nullable: true 
 
     adresseRemisage: 
 
      type: text 
 
      nullable: true 
 
     dateDebutRemisage: 
 
      type: date 
 
      nullable: true 
 
     dateFinRemisage: 
 
      type: date 
 
      nullable: true 
 
     emailDirecteur: 
 
      type: string 
 
      length: 255 
 
      nullable: true 
 
     conducteur: 
 
      type: boolean 
 
      nullable: true 
 
     mandataire: 
 
      type: boolean 
 
      nullable: true 
 
     motifRdv: 
 
      type: boolean 
 
      column: motif_rdv 
 
      nullable: true 
 
     motifFormation: 
 
      type: boolean 
 
      column: motif_formation 
 
      nullable: true 
 
     motifReunion: 
 
      type: boolean 
 
      column: motif_reunion 
 
      nullable: true 
 
     motifCollecte: 
 
      type: boolean 
 
      column: motif_collecte 
 
      nullable: true 
 
     motifInstallation: 
 
      type: boolean 
 
      column: motif_installation 
 
      nullable: true 
 
     motifProgrammation: 
 
      type: boolean 
 
      column: motif_programmation 
 
      nullable: true 
 
     motifDepannage: 
 
      type: boolean 
 
      column: motif_depannage 
 
      nullable: true 
 
     motifVad: 
 
      type: boolean 
 
      column: motif_vad 
 
      nullable: true 
 
     motifAutre: 
 
      type: text 
 
      column: motif_autre 
 
      nullable: true 
 
     commentaires: 
 
      type: text 
 
      nullable: true 
 
     nombrePersonne: 
 
      type: integer 
 
      column: nombre_personne 
 
      nullable: true 
 
     besoin: 
 
      type: string 
 
      column: besoin 
 
      nullable: true 
 
     nomMandataire: 
 
      type: string 
 
      length: 255 
 
      column: nom_mandataire 
 
      nullable: true 
 
     prenomMandataire: 
 
      type: string 
 
      length: 255 
 
      column: prenom_mandataire 
 
      nullable: true 
 
     emailMandataire: 
 
      type: string 
 
      length: 255 
 
      column: email_mandataire 
 
      nullable: true 
 
     honneur: 
 
      type: boolean 
 
      column: honneur 
 
      nullable: true 
 

 
    manyToOne: 
 
     vehicules: 
 
      targetEntity: Vehicules 
 
      inversedBy: reservations 
 
      joinColumn: 
 
       name: vehicules_id 
 
       referenceColumnName: id 
 
      cascade:  [persist] 
 

 
     user: 
 
      targetEntity: Application\Sonata\UserBundle\Entity\User 
 
      inversedBy: reservations 
 
      joinColumn: 
 
       name: user_id 
 
       referenceColumnName: id 
 

 
     pool: 
 
      targetEntity: Pool 
 
      inversedBy: reservations 
 
      joinColumn: 
 
       name: pool_id 
 
       referenceColumnName: id 
 
      cascade:  [persist] 
 
       
 
    lifecycleCallbacks: { }

而且我composer.json

{ 
 
\t "name" : "cosylvestre/flotte", 
 
\t "license" : "proprietary", 
 
\t "type" : "project", 
 
\t "autoload" : { 
 
\t \t "psr-4" : { 
 
\t \t \t "" : "src/" 
 
\t \t } 
 
\t }, 
 
\t "require" : { 
 
\t \t "php" : ">=5.3.9", 
 
\t \t "symfony/symfony" : "2.7.*", 
 
\t \t "doctrine/orm" : "^2.4.8", 
 
\t \t "doctrine/doctrine-bundle" : "~1.4", 
 
\t \t "symfony/assetic-bundle" : "~2.3", 
 
\t \t "symfony/swiftmailer-bundle" : "~2.3", 
 
\t \t "symfony/monolog-bundle" : "~2.4", 
 
\t \t "sensio/distribution-bundle" : "~4.0", 
 
\t \t "sensio/framework-extra-bundle" : "^3.0.2", 
 
\t \t "incenteev/composer-parameter-handler" : "~2.0", 
 
\t \t "sonata-project/admin-bundle" : "^3.1", 
 
\t \t "sonata-project/doctrine-orm-admin-bundle" : "3.0.4", 
 
\t \t "sonata-project/easy-extends-bundle" : "^2.1", 
 
\t \t "sonata-project/user-bundle" : "3.0.1", 
 
\t \t "sonata-project/core-bundle" : "^3.0" 
 
\t }, 
 
\t "require-dev" : { 
 
\t \t "sensio/generator-bundle" : "~2.3", 
 
\t \t "symfony/phpunit-bridge" : "~2.7", 
 
\t \t "phpunit/phpunit" : "4.8.24", 
 
\t \t "doctrine/doctrine-fixtures-bundle" : "^2.3", 
 
\t \t "liip/functional-test-bundle" : "1.0.*" 
 
\t }, 
 
\t "scripts" : { 
 
\t \t "post-install-cmd" : [ 
 
\t \t \t "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" 
 
\t \t ], 
 
\t \t "post-update-cmd" : [ 
 
\t \t \t "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 
 
\t \t \t "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" 
 
\t \t ] 
 
\t }, 
 
\t "config" : { 
 
\t \t "bin-dir" : "bin", 
 
\t \t "platform" : { 
 
\t \t \t "php" : "5.3.9" 
 
\t \t } 
 
\t }, 
 
\t "extra" : { 
 
\t \t "symfony-app-dir" : "app", 
 
\t \t "symfony-web-dir" : "web", 
 
\t \t "symfony-assets-install" : "relative", 
 
\t \t "incenteev-parameters" : { 
 
\t \t \t "file" : "app/config/parameters.yml" 
 
\t \t } 
 
\t } 
 
}

而且我不必在我編輯頁面小時和分鐘。我只有d-m-y。但我也需要有h:m。

謝謝你的幫助。

+0

有無你找到你的答案? – pbenard

+0

是Put12co22mer2。我們必須在3.1版本中顯示過濾器。所以你給我的答案是好的。 – CoralieS

回答

1

Following the doc

所有過濾器默認情況下,節省空間隱藏起來。用戶必須檢查 他想要使用哪個過濾器。

要使過濾器始終可見(即使處於非活動狀態),請將 參數show_filter設置爲true。

protected function configureDatagridFilters(DatagridMapper $datagridMapper) 
{ 
    $datagridMapper 
     ->add('phone') 
     ->add('email', null, array(
      'show_filter' => true 
     )) 

     // ... 
    ; 
} 

我會嘗試設置'show_filter'選項....


爲了您的小時和分鐘,你已經使用的,而不是datetime領域date

+0

默認情況下,過濾器確實處於隱藏狀態,但通過「過濾器」按鈕可用。如果他們根本沒有出現,也許檢查你是否有一些衝突的模板覆蓋。 – Soullivaneuh

相關問題