From 316c638e1d668efb252bc73f14e7bd3c8c4ac81d Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Wed, 7 Aug 2013 09:43:31 +0200 Subject: [PATCH 01/21] WORK IN PROGRESS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Possibilité d'utiliser un fichier yml à la place des annotations. Pour l'instant, le fichier MyEntity.grid.yml est recherché dans le même répertoire que MyEntity.php Le fichier MyEntity.yml a cette structure : Namespace\of\MyEntity: Source: columns: id : groups : [group1, group2] myColumn: ~ Columns: id: filterable: true visible: true id: id title: MonId myColumn: id : idColumn title : title filterable: true visible: true TODO : - Trouver une stratégie pour déterminer l'emplacement du fichier yml associé à l'entité - Valider le format du fichier YML en amont (utilisation de TreeBuilder ?) - Ecrire des tests --- Grid/Mapping/Driver/Yaml.php | 133 ++++++++++++++++++++++++++++++++++ Resources/config/services.xml | 5 +- 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 Grid/Mapping/Driver/Yaml.php diff --git a/Grid/Mapping/Driver/Yaml.php b/Grid/Mapping/Driver/Yaml.php new file mode 100644 index 00000000..306e72cf --- /dev/null +++ b/Grid/Mapping/Driver/Yaml.php @@ -0,0 +1,133 @@ + + * (c) Nicolas Potier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace APY\DataGridBundle\Grid\Mapping\Driver; + +use APY\DataGridBundle\Grid\Mapping\Column as Column; +use APY\DataGridBundle\Grid\Mapping\Source as Source; + +use Symfony\Component\Yaml\Parser; +use Symfony\Component\Yaml\Exception\ParseException; + +class Yaml implements DriverInterface +{ + + protected $columns; + protected $filterable; + protected $fields; + protected $loaded; + protected $groupBy; + + /** + * File extension + * @var string + */ + protected $_extension = '.grid.yml'; + + public function getClassColumns($class, $group = 'default') + { + $this->loadMetadataFromReader($class, $group); + + return $this->columns[$class][$group]; + } + + public function getFieldsMetadata($class, $group = 'default') + { + $this->loadMetadataFromReader($class, $group); + + return $this->fields[$class][$group]; + } + + public function getGroupBy($class, $group = 'default') + { + return isset($this->groupBy[$class][$group]) ? $this->groupBy[$class][$group] : array(); + } + + protected function loadMetadataFromReader($className, $group = 'default') + { + if (isset($this->loaded[$className][$group])) return; + + $instance = new \ReflectionClass($className); + $content = $this->getYamlContent($instance); + + // TODO valider la présence de ces clés + // Peut être en passant par un TreeBuilder ? + $class = $instance->getName(); + if (!isset($this->columns[$class])) { + $this->columns[$class] = array(); + } + + $columns = $content[$class]["Source"]["columns"]; + foreach ($columns as $colName => $properties) { + if (isset($properties["group"])) { + $groups = explode(",", $properties["group"]); + } + else { + $groups = array("default"); + } + + foreach ($groups as $group) { + if (!isset($this->columns[$class][$group])) { + $this->columns[$class][$group] = array(); + } + $this->columns[$class][$group][] = $colName; + } + } + + $fields = $content[$class]["Columns"]; + foreach ($fields as $fieldName => $properties) { + if (isset($properties["group"])) { + $groups = explode(",", $properties["group"]); + } + else { + $groups = array("default"); + } + foreach ($groups as $group) { + if (!isset($this->fields[$class][$group])) { + $this->fields[$class][$group] = array(); + } + $this->fields[$class][$group][$fieldName] = $properties; + } + } + + $groupBys = isset($content[$class]["Source"]["groupBy"])? $content[$class]["Source"]["groupBy"] : array(); + foreach($groupBys as $group => $groupBy) { + $this->groupBy[$class][$group] = $groupBy; + } + + $filterables = isset($content[$class]["Source"]["filterable"]) ? $content[$class]["Source"]["filterable"] : array(); + foreach($filterables as $group => $filterable) { + $this->filterable[$class][$group] = $filterable; + } + + + + $this->loaded[$className][$group] = true; + } + + private function getYamlContent($instance) + { + $yamlFile = str_replace(".php", $this->_extension, $instance->getFileName()); + if (!file_exists($yamlFile)) { + throw new \Exception("Yaml configuration file was not found for $class"); + } + + $yamlParser = new Parser(); + try { + $content = $yamlParser->parse(file_get_contents($yamlFile)); + } catch (ParseException $e) { + printf("Unable to parse the YAML string: %s", $e->getMessage()); + } + + return $content; + } +} diff --git a/Resources/config/services.xml b/Resources/config/services.xml index af87ad94..857139da 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -45,11 +45,14 @@ + + - + + 1 From 75998d853f1ec672f53afb5b69949299595c2e71 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Thu, 8 Aug 2013 15:09:54 +0200 Subject: [PATCH 02/21] WORK IN PROGESS : emplacement des fichiers YML dans @MyBundle/Resources/config/grid/MyEntity.MyGroup.yml --- Grid/Mapping/Driver/Yaml.php | 105 ++++++++++++++++++++++------------ Resources/config/services.xml | 1 + 2 files changed, 69 insertions(+), 37 deletions(-) diff --git a/Grid/Mapping/Driver/Yaml.php b/Grid/Mapping/Driver/Yaml.php index 306e72cf..3269a0b6 100644 --- a/Grid/Mapping/Driver/Yaml.php +++ b/Grid/Mapping/Driver/Yaml.php @@ -27,12 +27,19 @@ class Yaml implements DriverInterface protected $loaded; protected $groupBy; + protected $kernel; /** * File extension * @var string */ protected $_extension = '.grid.yml'; + + public function __construct($kernel) + { + $this->kernel = $kernel; + } + public function getClassColumns($class, $group = 'default') { $this->loadMetadataFromReader($class, $group); @@ -57,7 +64,7 @@ protected function loadMetadataFromReader($className, $group = 'default') if (isset($this->loaded[$className][$group])) return; $instance = new \ReflectionClass($className); - $content = $this->getYamlContent($instance); + $content = $this->getYamlContent($instance, $group); // TODO valider la présence de ces clés // Peut être en passant par un TreeBuilder ? @@ -68,35 +75,18 @@ protected function loadMetadataFromReader($className, $group = 'default') $columns = $content[$class]["Source"]["columns"]; foreach ($columns as $colName => $properties) { - if (isset($properties["group"])) { - $groups = explode(",", $properties["group"]); - } - else { - $groups = array("default"); - } - - foreach ($groups as $group) { - if (!isset($this->columns[$class][$group])) { - $this->columns[$class][$group] = array(); - } - $this->columns[$class][$group][] = $colName; - } + if (!isset($this->columns[$class][$group])) { + $this->columns[$class][$group] = array(); + } + $this->columns[$class][$group][] = $colName; } $fields = $content[$class]["Columns"]; foreach ($fields as $fieldName => $properties) { - if (isset($properties["group"])) { - $groups = explode(",", $properties["group"]); - } - else { - $groups = array("default"); - } - foreach ($groups as $group) { - if (!isset($this->fields[$class][$group])) { - $this->fields[$class][$group] = array(); - } - $this->fields[$class][$group][$fieldName] = $properties; + if (!isset($this->fields[$class][$group])) { + $this->fields[$class][$group] = array(); } + $this->fields[$class][$group][$fieldName] = $properties; } $groupBys = isset($content[$class]["Source"]["groupBy"])? $content[$class]["Source"]["groupBy"] : array(); @@ -109,25 +99,66 @@ protected function loadMetadataFromReader($className, $group = 'default') $this->filterable[$class][$group] = $filterable; } - - $this->loaded[$className][$group] = true; } - private function getYamlContent($instance) + /** + * Get The Yaml file associated to a class and a group + * @param \ReflectionClass $instance an instance of the class + * @param String $group the name of the group + * @return array the parsed YAML file + */ + private function getYamlContent($instance, $group) { - $yamlFile = str_replace(".php", $this->_extension, $instance->getFileName()); - if (!file_exists($yamlFile)) { - throw new \Exception("Yaml configuration file was not found for $class"); - } + $yamlFile = $this->locateYamlFile($instance, $group); $yamlParser = new Parser(); - try { - $content = $yamlParser->parse(file_get_contents($yamlFile)); - } catch (ParseException $e) { - printf("Unable to parse the YAML string: %s", $e->getMessage()); - } + $content = $yamlParser->parse(file_get_contents($yamlFile)); return $content; } + + /** + * Locate a YAML File based on a directory convention + * @param \ReflectionClass $instance an instance of the class + * @param String $group the name of the group + * @return String the file name + */ + private function locateYamlFile($instance, $group) { + $bundleName = $this->getBundleNameForClass($instance->getName()); + + $fileToLocate = sprintf("@%s/Resources/config/grid/%s.%s%s", + $bundleName, + basename($instance->getFileName(), ".php"), + $group, + $this->_extension ); + + return $this->kernel->locateResource($fileToLocate); + } + + /** + * Get The Bundle Name of an entity class + * @param String an entity namespace + * @return the Bundle name of the entity + */ + private function getBundleNameForClass($rootEntityName) { + $bundles = $this->kernel->getBundles(); + $bundleName = null; + + foreach($bundles as $type => $bundle){ + $className = get_class($bundle); + + $entityClass = substr($rootEntityName,0,strpos($rootEntityName,'\\Entity\\')); + + if(strpos($className,$entityClass) !== FALSE){ + $bundleName = $type; + } + } + + if (null === $bundleName) { + throw new \Exception(sprintf("Bundle was not found for entity %s, maybe you should declare it in AppKernel", $rootEntityName)); + } + + return $bundleName; + } } diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 857139da..f8e5e3c9 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -46,6 +46,7 @@ + From 3dc0a0b3316edce05b5a2dc639c6aef1882044c6 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Thu, 8 Aug 2013 17:20:49 +0200 Subject: [PATCH 03/21] commande permettant de generer le fichier Grid associe a une entite et un groupe --- Command/GenerateGridCommand.php | 116 ++++++++++++++++++++++++++ Generator/GridYamlGenerator.php | 55 ++++++++++++ Resources/skeleton/grid/grid.yml.twig | 17 ++++ 3 files changed, 188 insertions(+) create mode 100644 Command/GenerateGridCommand.php create mode 100644 Generator/GridYamlGenerator.php create mode 100644 Resources/skeleton/grid/grid.yml.twig diff --git a/Command/GenerateGridCommand.php b/Command/GenerateGridCommand.php new file mode 100644 index 00000000..3377a7d5 --- /dev/null +++ b/Command/GenerateGridCommand.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace APY\DataGridBundle\Command; + +use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +use Sensio\Bundle\GeneratorBundle\Command\Validators; +use Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineCommand; + +use APY\DataGridBundle\Generator\GridYamlGenerator; + +class GenerateGridCommand extends GenerateDoctrineCommand +{ + /** + * File extension + * @var string + */ + protected $_extension = '.grid.yml'; + + protected function configure() + { + $this + ->setName('apydatagrid:generate:grid') + ->setDescription('Generate the grid configuration for an entity') + ->setDefinition(array( + new InputOption('entity', '', InputOption::VALUE_REQUIRED, 'The entity class name to initialize (shortcut notation)'), + new InputOption('group', '', InputOption::VALUE_REQUIRED, 'The group name'), + )) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + + $entity = Validators::validateEntityName($input->getOption('entity')); + $group = $input->getOption('group', "default"); + + list($bundle, $entity) = $this->parseShortcutNotation($entity); + + $entityClass = $this->getContainer()->get('doctrine')->getEntityNamespace($bundle).'\\'.$entity; + + /* + echo $bundle; + echo " "; + echo $entity; + echo " "; + echo $entityClass; + echo " "; + echo $group; +*/ + $instance = new \ReflectionClass($entityClass); + + $generator = $this->getGenerator(null); + $generator->generate($this->getContainer()->get('kernel')->getBundle($bundle), $entityClass, $entity, $group, $this->_extension); + /* + if (2 != count($parts = explode(':', $bundleEntity))) { + throw new \InvalidArgumentException(sprintf('The "%s" entity is not a valid a:b Bundle Entity.', $bundleEntity)); + } + + list($bundle, $entity) = $parts; + + $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); + + $name = $this->getContainer()->get('doctrine')->getEntityNamespace($bundle.'\\'.$entity); + + echo $name; die(); + /* + if (class_exists($name)) { + $output->writeln(sprintf('Generating entity "%s"', $name)); + $metadata = $manager->getClassMetadata($name, $input->getOption('path')); + } else { + $output->writeln(sprintf('Generating entities for namespace "%s"', $name)); + $metadata = $manager->getNamespaceMetadata($name, $input->getOption('path')); + } + */ + } + + protected function createGenerator($bundle = null) + { + //return null; + $generator = new GridYamlGenerator($this->getContainer()->get('filesystem')); + return $generator; + } + + /** + * Locate a YAML File based on a directory convention + * @param \ReflectionClass $instance an instance of the class + * @param String $group the name of the group + * @return String the file name + */ + /* + private function locateYamlFile($instance, $group) { + $bundleName = $this->getBundleNameForClass($instance->getName()); + + $fileToLocate = sprintf("@%s/Resources/config/grid/%s.%s%s", + $bundleName, + basename($instance->getFileName(), ".php"), + $group, + $this->_extension ); + + return $this->kernel->locateResource($fileToLocate); + } + */ +} \ No newline at end of file diff --git a/Generator/GridYamlGenerator.php b/Generator/GridYamlGenerator.php new file mode 100644 index 00000000..15c2e495 --- /dev/null +++ b/Generator/GridYamlGenerator.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace APY\DataGridBundle\Generator; + +use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Sensio\Bundle\GeneratorBundle\Generator\Generator; + + +class GridYamlGenerator extends Generator +{ + private $filesystem; + + /** + * Constructor. + * + * @param Filesystem $filesystem A Filesystem instance + */ + public function __construct(Filesystem $filesystem) + { + $this->filesystem = $filesystem; + } + + public function generate(BundleInterface $bundle, $entityClass, $entity, $group, $extension) + { + + $this->setSkeletonDirs(__DIR__.'/../Resources/skeleton'); + + $dir = sprintf("%s/Resources/config/grid",$bundle->getPath()); + if (!file_exists($dir)) { + $this->filesystem->mkdir($dir, 0777); + } + + $gridFile = sprintf("%s/%s.%s%s", $dir, $entity, $group, $extension); + + $instance = new \ReflectionClass($entityClass); + + $parameters = array( + 'columns' => $instance->getProperties(), + 'entityClass' => $entityClass + ); + + $this->renderFile('grid/grid.yml.twig', $gridFile, $parameters); + } + +} diff --git a/Resources/skeleton/grid/grid.yml.twig b/Resources/skeleton/grid/grid.yml.twig new file mode 100644 index 00000000..de17c452 --- /dev/null +++ b/Resources/skeleton/grid/grid.yml.twig @@ -0,0 +1,17 @@ +{{ entityClass }}: + Source: + columns: + {% spaceless %} + {% for column in columns %}{{ column.getName() }}: ~ + {% endfor %} + {% endspaceless %} + + groupBy: ~ + filterable: ~ + Columns: + {% for column in columns %}{{ column.getName() }}: + filterable: true + visible: true + id: {{ column.getName() }} + title: {{ column.getName() }} + {% endfor %} \ No newline at end of file From 5fffa22ac65d4b8d0cfaf61970a60abb0218c72a Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Thu, 8 Aug 2013 17:51:52 +0200 Subject: [PATCH 04/21] Rend le Driver YAML silencieux si le fichier est absent Fait cohabiter les Drivers Annotation et YAML --- Grid/Mapping/Driver/Yaml.php | 45 ++++++++++++++++++++++------------- Resources/config/services.xml | 9 +++++-- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Grid/Mapping/Driver/Yaml.php b/Grid/Mapping/Driver/Yaml.php index 3269a0b6..6a312a2b 100644 --- a/Grid/Mapping/Driver/Yaml.php +++ b/Grid/Mapping/Driver/Yaml.php @@ -28,7 +28,7 @@ class Yaml implements DriverInterface protected $groupBy; protected $kernel; - /** + /** * File extension * @var string */ @@ -42,16 +42,16 @@ public function __construct($kernel) public function getClassColumns($class, $group = 'default') { - $this->loadMetadataFromReader($class, $group); + $this->loadMetadataFromReader($class, $group); - return $this->columns[$class][$group]; + return isset($this->columns[$class][$group]) ? $this->columns[$class][$group] : array(); } public function getFieldsMetadata($class, $group = 'default') { $this->loadMetadataFromReader($class, $group); - return $this->fields[$class][$group]; + return isset($this->fields[$class][$group]) ? $this->fields[$class][$group] : array(); } public function getGroupBy($class, $group = 'default') @@ -63,22 +63,24 @@ protected function loadMetadataFromReader($className, $group = 'default') { if (isset($this->loaded[$className][$group])) return; - $instance = new \ReflectionClass($className); + $instance = new \ReflectionClass($className); $content = $this->getYamlContent($instance, $group); - + if (!$content) { + return; + } // TODO valider la présence de ces clés // Peut être en passant par un TreeBuilder ? $class = $instance->getName(); if (!isset($this->columns[$class])) { - $this->columns[$class] = array(); + $this->columns[$class] = array(); } $columns = $content[$class]["Source"]["columns"]; foreach ($columns as $colName => $properties) { - if (!isset($this->columns[$class][$group])) { - $this->columns[$class][$group] = array(); - } - $this->columns[$class][$group][] = $colName; + if (!isset($this->columns[$class][$group])) { + $this->columns[$class][$group] = array(); + } + $this->columns[$class][$group][] = $colName; } $fields = $content[$class]["Columns"]; @@ -109,13 +111,16 @@ protected function loadMetadataFromReader($className, $group = 'default') * @return array the parsed YAML file */ private function getYamlContent($instance, $group) - { + { $yamlFile = $this->locateYamlFile($instance, $group); - - $yamlParser = new Parser(); - $content = $yamlParser->parse(file_get_contents($yamlFile)); + $content = false; - return $content; + if ($yamlFile) { + $yamlParser = new Parser(); + $content = $yamlParser->parse(file_get_contents($yamlFile)); + } + + return $content; } /** @@ -133,7 +138,13 @@ private function locateYamlFile($instance, $group) { $group, $this->_extension ); - return $this->kernel->locateResource($fileToLocate); + try { + return $this->kernel->locateResource($fileToLocate); + } + catch (\Exception $e) { + // The exception is silent + return false; + } } /** diff --git a/Resources/config/services.xml b/Resources/config/services.xml index f8e5e3c9..8bad6f8d 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -45,6 +45,7 @@ + @@ -52,10 +53,14 @@ - - + 1 + + + 2 + + From 36581eac80d357ef2bc68485e3f6a98bb116611c Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Thu, 8 Aug 2013 17:58:43 +0200 Subject: [PATCH 05/21] code cleanup --- Command/GenerateGridCommand.php | 74 +++++---------------------------- 1 file changed, 10 insertions(+), 64 deletions(-) diff --git a/Command/GenerateGridCommand.php b/Command/GenerateGridCommand.php index 3377a7d5..97e68545 100644 --- a/Command/GenerateGridCommand.php +++ b/Command/GenerateGridCommand.php @@ -23,7 +23,7 @@ class GenerateGridCommand extends GenerateDoctrineCommand { - /** + /** * File extension * @var string */ @@ -36,81 +36,27 @@ protected function configure() ->setDescription('Generate the grid configuration for an entity') ->setDefinition(array( new InputOption('entity', '', InputOption::VALUE_REQUIRED, 'The entity class name to initialize (shortcut notation)'), - new InputOption('group', '', InputOption::VALUE_REQUIRED, 'The group name'), + new InputOption('group', '', InputOption::VALUE_REQUIRED, 'The group name'), )) ; } protected function execute(InputInterface $input, OutputInterface $output) - { - - $entity = Validators::validateEntityName($input->getOption('entity')); - $group = $input->getOption('group', "default"); + { + $entity = Validators::validateEntityName($input->getOption('entity')); + $group = $input->getOption('group', "default"); list($bundle, $entity) = $this->parseShortcutNotation($entity); - $entityClass = $this->getContainer()->get('doctrine')->getEntityNamespace($bundle).'\\'.$entity; - - /* - echo $bundle; - echo " "; - echo $entity; - echo " "; - echo $entityClass; - echo " "; - echo $group; -*/ - $instance = new \ReflectionClass($entityClass); - - $generator = $this->getGenerator(null); - $generator->generate($this->getContainer()->get('kernel')->getBundle($bundle), $entityClass, $entity, $group, $this->_extension); - /* - if (2 != count($parts = explode(':', $bundleEntity))) { - throw new \InvalidArgumentException(sprintf('The "%s" entity is not a valid a:b Bundle Entity.', $bundleEntity)); - } - - list($bundle, $entity) = $parts; - - $manager = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine')); - - $name = $this->getContainer()->get('doctrine')->getEntityNamespace($bundle.'\\'.$entity); - - echo $name; die(); - /* - if (class_exists($name)) { - $output->writeln(sprintf('Generating entity "%s"', $name)); - $metadata = $manager->getClassMetadata($name, $input->getOption('path')); - } else { - $output->writeln(sprintf('Generating entities for namespace "%s"', $name)); - $metadata = $manager->getNamespaceMetadata($name, $input->getOption('path')); - } - */ + $entityClass = $this->getContainer()->get('doctrine')->getEntityNamespace($bundle).'\\'.$entity; + $instance = new \ReflectionClass($entityClass); + $generator = $this->getGenerator(null); + $generator->generate($this->getContainer()->get('kernel')->getBundle($bundle), $entityClass, $entity, $group, $this->_extension); } - protected function createGenerator($bundle = null) + protected function createGenerator($bundle = null) { - //return null; $generator = new GridYamlGenerator($this->getContainer()->get('filesystem')); return $generator; } - - /** - * Locate a YAML File based on a directory convention - * @param \ReflectionClass $instance an instance of the class - * @param String $group the name of the group - * @return String the file name - */ - /* - private function locateYamlFile($instance, $group) { - $bundleName = $this->getBundleNameForClass($instance->getName()); - - $fileToLocate = sprintf("@%s/Resources/config/grid/%s.%s%s", - $bundleName, - basename($instance->getFileName(), ".php"), - $group, - $this->_extension ); - - return $this->kernel->locateResource($fileToLocate); - } - */ } \ No newline at end of file From a8b009b85fdfe62230840ba756db3c8eb2491a63 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Thu, 8 Aug 2013 18:01:31 +0200 Subject: [PATCH 06/21] code cleanup --- Grid/Mapping/Driver/Yaml.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Grid/Mapping/Driver/Yaml.php b/Grid/Mapping/Driver/Yaml.php index 6a312a2b..8e775da0 100644 --- a/Grid/Mapping/Driver/Yaml.php +++ b/Grid/Mapping/Driver/Yaml.php @@ -28,6 +28,7 @@ class Yaml implements DriverInterface protected $groupBy; protected $kernel; + /** * File extension * @var string From 663d2f42df601ab1162feb79ff160a0c6807544d Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Thu, 8 Aug 2013 18:02:03 +0200 Subject: [PATCH 07/21] code cleanup --- Generator/GridYamlGenerator.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Generator/GridYamlGenerator.php b/Generator/GridYamlGenerator.php index 15c2e495..67bcf9bd 100644 --- a/Generator/GridYamlGenerator.php +++ b/Generator/GridYamlGenerator.php @@ -32,19 +32,17 @@ public function __construct(Filesystem $filesystem) public function generate(BundleInterface $bundle, $entityClass, $entity, $group, $extension) { - $this->setSkeletonDirs(__DIR__.'/../Resources/skeleton'); - $dir = sprintf("%s/Resources/config/grid",$bundle->getPath()); - if (!file_exists($dir)) { + if (!file_exists($dir)) { $this->filesystem->mkdir($dir, 0777); } $gridFile = sprintf("%s/%s.%s%s", $dir, $entity, $group, $extension); - $instance = new \ReflectionClass($entityClass); + $instance = new \ReflectionClass($entityClass); - $parameters = array( + $parameters = array( 'columns' => $instance->getProperties(), 'entityClass' => $entityClass ); From 0a38ff4199a811e8d164cac33fb6d497aa9a52c0 Mon Sep 17 00:00:00 2001 From: Matthieu Auger Date: Mon, 19 Aug 2013 17:19:51 +0200 Subject: [PATCH 08/21] Arguments instead of options --- Command/GenerateGridCommand.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Command/GenerateGridCommand.php b/Command/GenerateGridCommand.php index 97e68545..60092e4d 100644 --- a/Command/GenerateGridCommand.php +++ b/Command/GenerateGridCommand.php @@ -34,17 +34,15 @@ protected function configure() $this ->setName('apydatagrid:generate:grid') ->setDescription('Generate the grid configuration for an entity') - ->setDefinition(array( - new InputOption('entity', '', InputOption::VALUE_REQUIRED, 'The entity class name to initialize (shortcut notation)'), - new InputOption('group', '', InputOption::VALUE_REQUIRED, 'The group name'), - )) + ->addArgument('entity', InputArgument::REQUIRED, 'The entity class name to initialize (shortcut notation)') + ->addArgument('group', InputArgument::REQUIRED, 'The group name') ; } protected function execute(InputInterface $input, OutputInterface $output) { - $entity = Validators::validateEntityName($input->getOption('entity')); - $group = $input->getOption('group', "default"); + $entity = Validators::validateEntityName($input->getArgument('entity')); + $group = $input->getArgument('group', "default"); list($bundle, $entity) = $this->parseShortcutNotation($entity); From 441ef3ca09c14ce8e961437fb7028c38f422d109 Mon Sep 17 00:00:00 2001 From: Matthieu Auger Date: Mon, 19 Aug 2013 17:21:07 +0200 Subject: [PATCH 09/21] Fix endlines --- Command/GenerateGridCommand.php | 2 +- Resources/skeleton/grid/grid.yml.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Command/GenerateGridCommand.php b/Command/GenerateGridCommand.php index 60092e4d..23f0f25d 100644 --- a/Command/GenerateGridCommand.php +++ b/Command/GenerateGridCommand.php @@ -57,4 +57,4 @@ protected function createGenerator($bundle = null) $generator = new GridYamlGenerator($this->getContainer()->get('filesystem')); return $generator; } -} \ No newline at end of file +} diff --git a/Resources/skeleton/grid/grid.yml.twig b/Resources/skeleton/grid/grid.yml.twig index de17c452..441087d9 100644 --- a/Resources/skeleton/grid/grid.yml.twig +++ b/Resources/skeleton/grid/grid.yml.twig @@ -14,4 +14,4 @@ visible: true id: {{ column.getName() }} title: {{ column.getName() }} - {% endfor %} \ No newline at end of file + {% endfor %} From 618ec527bba52c2e0f59fefee59bac46ad2bcb65 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Mon, 7 Oct 2013 18:24:59 +0200 Subject: [PATCH 10/21] configuration propre --- DependencyInjection/APYDataGridExtension.php | 1 + DependencyInjection/Configuration.php | 13 +++++++++- Grid/Mapping/Metadata/Manager.php | 27 +++++++++++++++++++- Resources/config/services.xml | 13 +++------- 4 files changed, 43 insertions(+), 11 deletions(-) diff --git a/DependencyInjection/APYDataGridExtension.php b/DependencyInjection/APYDataGridExtension.php index 50682235..864d2d4b 100644 --- a/DependencyInjection/APYDataGridExtension.php +++ b/DependencyInjection/APYDataGridExtension.php @@ -28,6 +28,7 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('services.xml'); $loader->load('columns.xml'); + $container->setParameter('apy_data_grid.drivers', $config['drivers']); $container->setParameter('apy_data_grid.limits', $config['limits']); $container->setParameter('apy_data_grid.persistence', $config['persistence']); $container->setParameter('apy_data_grid.no_data_message', $config['no_data_message']); diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 6d227fc1..6d6e5476 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -31,7 +31,18 @@ public function getConfigTreeBuilder() ->defaultValue(array(20 => '20', 50 => '50', 100 => '100')) ->prototype('scalar')->end() ->end() - ->booleanNode('persistence')->defaultFalse()->end() + + ->arrayNode("drivers") + ->validate() + ->ifTrue(function($v) { + return !in_array($v, array("yaml", "annotation")); + }) + ->thenInvalid("Some drivers are not known") + ->end() + ->defaultValue(array('annotation', 'yml')) + ->prototype('scalar')->end() + ->end() + ->booleanNode('persistence')->defaultFalse()->end() ->scalarNode('no_data_message')->defaultValue('No data')->end() ->scalarNode('no_result_message')->defaultValue('No result')->end() ->scalarNode('actions_columns_size')->defaultValue(-1)->end() diff --git a/Grid/Mapping/Metadata/Manager.php b/Grid/Mapping/Metadata/Manager.php index dd908147..f254250d 100644 --- a/Grid/Mapping/Metadata/Manager.php +++ b/Grid/Mapping/Metadata/Manager.php @@ -21,8 +21,11 @@ class Manager */ protected $drivers; - public function __construct() + protected $container; + + public function __construct($container) { + $this->container = $container; $this->drivers = new DriverHeap(); } @@ -31,6 +34,28 @@ public function addDriver($driver, $priority) $this->drivers->insert($driver, $priority); } + /** + * Add drivers to the driver list + */ + public function setDrivers($driverList) + { + $priority = 1; + foreach ($driverList as $driverName) { + switch ($driverName) { + case "annotation" : + $driver = $this->container->get("grid.metadata.driver.annotation"); + break; + case "yaml" : + $driver = $this->container->get("grid.metadata.driver.yaml"); + break; + default : + throw new \Exception("Driver $driverName not found"); + } + $this->addDriver($service, $priority); + $priority++; + } + } + /** * @todo remove this hack * @return \APY\DataGridBundle\Grid\Mapping\Metadata\DriverHeap diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 5b762e3d..167a15e9 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -55,15 +55,10 @@ - - - 1 - - - - 2 - - + + + %apy_data_grid.drivers% + From 803f2e599a7a2f144a4eeaf4504675c668d0466d Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Tue, 5 Nov 2013 01:29:53 +0100 Subject: [PATCH 11/21] fix service config --- Resources/config/services.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 167a15e9..ef5c67a7 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -54,7 +54,6 @@ - %apy_data_grid.drivers% From 7f9202ae5f3e8bb46b4ba78bde1b34a3775b21c1 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Tue, 5 Nov 2013 01:31:18 +0100 Subject: [PATCH 12/21] fix --- Grid/Mapping/Metadata/Manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Grid/Mapping/Metadata/Manager.php b/Grid/Mapping/Metadata/Manager.php index f254250d..70fad14d 100644 --- a/Grid/Mapping/Metadata/Manager.php +++ b/Grid/Mapping/Metadata/Manager.php @@ -45,13 +45,13 @@ public function setDrivers($driverList) case "annotation" : $driver = $this->container->get("grid.metadata.driver.annotation"); break; - case "yaml" : + case "yml" : $driver = $this->container->get("grid.metadata.driver.yaml"); break; default : throw new \Exception("Driver $driverName not found"); } - $this->addDriver($service, $priority); + $this->addDriver($driver, $priority); $priority++; } } From 8b04830d65f4f666c00d0bc5b5eb267ca1536ee5 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Tue, 5 Nov 2013 09:54:14 +0100 Subject: [PATCH 13/21] remove config constraints --- DependencyInjection/Configuration.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 6d6e5476..79a941d3 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -33,12 +33,13 @@ public function getConfigTreeBuilder() ->end() ->arrayNode("drivers") - ->validate() + /* ->validate() ->ifTrue(function($v) { - return !in_array($v, array("yaml", "annotation")); + return !in_array($v, array("yml", "annotation")); }) ->thenInvalid("Some drivers are not known") ->end() + */ ->defaultValue(array('annotation', 'yml')) ->prototype('scalar')->end() ->end() From 628c7c025f830fe3ae4361dd69de49212eec2590 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Mon, 2 Dec 2013 14:51:16 +0100 Subject: [PATCH 14/21] annotation : return empty array instead of array_keys where no information has been found --- Grid/Mapping/Driver/Annotation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Grid/Mapping/Driver/Annotation.php b/Grid/Mapping/Driver/Annotation.php index 15b40d6e..1eb359d4 100644 --- a/Grid/Mapping/Driver/Annotation.php +++ b/Grid/Mapping/Driver/Annotation.php @@ -81,7 +81,9 @@ protected function loadMetadataFromReader($className, $group = 'default') } if (empty($this->columns[$className][$group])) { - $this->columns[$className][$group] = array_keys($this->fields[$className][$group]); + // Return empty array instead of array keys + $this->columns[$className][$group] = array(); + //$this->columns[$className][$group] = array_keys($this->fields[$className][$group]); } else { foreach ($this->columns[$className][$group] as $columnId) { // Ignore mapped fields From 8e01fa86325955b1c5d50f608e1c204e8728a437 Mon Sep 17 00:00:00 2001 From: Dexter Morgan Date: Sun, 8 Dec 2013 22:16:12 +0100 Subject: [PATCH 15/21] fix export UTF8 Excel CSV --- Grid/Export/DSVExport.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Grid/Export/DSVExport.php b/Grid/Export/DSVExport.php index bf25dba6..141e1da3 100644 --- a/Grid/Export/DSVExport.php +++ b/Grid/Export/DSVExport.php @@ -45,13 +45,13 @@ public function computeData($grid) rewind($outstream); - $content = ''; + //$content = ''; + $content = "\xEF\xBB\xBF" ; while (($buffer = fgets($outstream)) !== false) { $content .= $buffer; } fclose($outstream); - $this->content = $content; } From b3872b687a85d8d341b736d1467d4d9a1ae337de Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Fri, 21 Nov 2014 17:26:41 +0100 Subject: [PATCH 16/21] YML documentation --- .../yml/yml_configuration.md | 67 +++++++++++++++++++ Resources/doc/summary.md | 59 ++++++++-------- 2 files changed, 97 insertions(+), 29 deletions(-) create mode 100644 Resources/doc/columns_configuration/yml/yml_configuration.md diff --git a/Resources/doc/columns_configuration/yml/yml_configuration.md b/Resources/doc/columns_configuration/yml/yml_configuration.md new file mode 100644 index 00000000..ede30755 --- /dev/null +++ b/Resources/doc/columns_configuration/yml/yml_configuration.md @@ -0,0 +1,67 @@ +YML Configuration +================================ + +## YML File location + +By convention, files are located in ``MyBundle/Resouces/config/grid/`` folder. + +The file name must be *MyEntity*.*gridGroup*.grid.yml + +* *MyEntity* : the name of your entity +* *gridGroup* : the name of the group + +## Generating YML file + +In order to generate you YML file, you can use a command provided by APYDataGrid + +```sh +php app/console apydatagrid:generate:grid MyBunddle:MyEntity gridGroup +``` + +## Writting an YML file + + +### YML File content +All parameters described in the Annotation section can be used in YML file. You just have to respect indentation and Source / Colums sections. + +### Example of an YML file: + +If you are familiar with doctrine YML configuration you shouldn't have problems to create YML files for APYDataGrid. + +```yaml +# //src/ACSEO/Bundle/CalendrierBundle/Resources/config/grid/Article.default.grid.yml + +# This is your Entity +ACSEO\Bundle\CalendrierBundle\Entity\Article: + # Insert here source informations + Source: + columns: + id: ~ + title: ~ + content: ~ + publishedDate: ~ + groupBy: ~ + filterable: ~ + # Insert here columns informations + Columns: + id: + filterable: true + visible: true + id: id + title: id + title: + filterable: true + visible: true + id: title + title: title + content: + filterable: true + visible: true + id: content + title: content + publishedDate: + filterable: true + visible: true + id: publishedDate + title: publishedDate +``` diff --git a/Resources/doc/summary.md b/Resources/doc/summary.md index 86e0f445..1f135a58 100644 --- a/Resources/doc/summary.md +++ b/Resources/doc/summary.md @@ -21,36 +21,37 @@ SUMMARY 1. [Display an external filters box](template/render_external_filters.md) 1. [Display a pagerfanta pager](template/render_pagerfanta_pager.md) -1. [Columns Configuration with Annotations](columns_configuration/) +1. [Columns Configuration](columns_configuration/) 1. [Annotations](columns_configuration/annotations/) - 1. [Source Annotation](columns_configuration/annotations/source_annotation.md) - 1. [Column Annotation for a property](columns_configuration/annotations/column_annotation_property.md) - 1. [Column Annotation for a class](columns_configuration/annotations/column_annotation_class.md) - 1. [ORM Association Mapping](columns_configuration/annotations/association_mapping.md) - 1. [DQL Functions](columns_configuration/annotations/dql_function.md) - 1. [Column Types](columns_configuration/types/) - 1. [Text Column](columns_configuration/types/text_column.md) - 1. [Number Column](columns_configuration/types/number_column.md) - 1. [Decimal](columns_configuration/types/number_column.md) - 1. [Currency](columns_configuration/types/number_column.md) - 1. [Percent](columns_configuration/types/number_column.md) - 1. [Duration](columns_configuration/types/number_column.md) - 1. [Scientific](columns_configuration/types/number_column.md) - 1. [Spell Out](columns_configuration/types/number_column.md) - 1. [Boolean Column](columns_configuration/types/boolean_column.md) - 1. [DateTime Column](columns_configuration/types/datetime_column.md) - 1. [Date Column](columns_configuration/types/date_column.md) - 1. [_Time_](columns_configuration/types/time_column.md) - 1. [Array Column](columns_configuration/types/array_column.md) - 1. [Blank Column](columns_configuration/types/blank_column.md) - 1. [Rank Column](columns_configuration/types/rank_column.md) - 1. [Join Column](columns_configuration/types/join_column.md) - 1. [Create your column](columns_configuration/types/create_column.md) - 1. [Filters](columns_configuration/filters/) - 1. [Input Filter](columns_configuration/filters/input_filter.md) - 1. [Select Filter](columns_configuration/filters/select_filter.md) - 1. [Create a filter](columns_configuration/filters/create_filter.md) - + 1. [Annotations] + 1. [Source Annotation](columns_configuration/annotations/source_annotation.md) + 1. [Column Annotation for a property](columns_configuration/annotations/column_annotation_property.md) + 1. [Column Annotation for a class](columns_configuration/annotations/column_annotation_class.md) + 1. [ORM Association Mapping](columns_configuration/annotations/association_mapping.md) + 1. [DQL Functions](columns_configuration/annotations/dql_function.md) + 1. [Column Types](columns_configuration/types/) + 1. [Text Column](columns_configuration/types/text_column.md) + 1. [Number Column](columns_configuration/types/number_column.md) + 1. [Decimal](columns_configuration/types/number_column.md) + 1. [Currency](columns_configuration/types/number_column.md) + 1. [Percent](columns_configuration/types/number_column.md) + 1. [Duration](columns_configuration/types/number_column.md) + 1. [Scientific](columns_configuration/types/number_column.md) + 1. [Spell Out](columns_configuration/types/number_column.md) + 1. [Boolean Column](columns_configuration/types/boolean_column.md) + 1. [DateTime Column](columns_configuration/types/datetime_column.md) + 1. [Date Column](columns_configuration/types/date_column.md) + 1. [_Time_](columns_configuration/types/time_column.md) + 1. [Array Column](columns_configuration/types/array_column.md) + 1. [Blank Column](columns_configuration/types/blank_column.md) + 1. [Rank Column](columns_configuration/types/rank_column.md) + 1. [Join Column](columns_configuration/types/join_column.md) + 1. [Create your column](columns_configuration/types/create_column.md) + 1. [Filters](columns_configuration/filters/) + 1. [Input Filter](columns_configuration/filters/input_filter.md) + 1. [Select Filter](columns_configuration/filters/select_filter.md) + 1. [Create a filter](columns_configuration/filters/create_filter.md) + 1. [YML](columns_configuration/yml/yml_configuration.yml) 1. [Grid Configuration in PHP](grid_configuration/) 1. [Set the identifier of the grid](grid_configuration/set_grid_identifier.md) 1. [Set the persistence of the grid](grid_configuration/set_grid_persistence.md) From 40c3c88a761f6591312ad31ee6397d0410e793a6 Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Fri, 21 Nov 2014 17:29:10 +0100 Subject: [PATCH 17/21] YML documentation --- Resources/doc/summary.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Resources/doc/summary.md b/Resources/doc/summary.md index 1f135a58..31a296c1 100644 --- a/Resources/doc/summary.md +++ b/Resources/doc/summary.md @@ -22,8 +22,9 @@ SUMMARY 1. [Display a pagerfanta pager](template/render_pagerfanta_pager.md) 1. [Columns Configuration](columns_configuration/) + 1. [YML](columns_configuration/yml/yml_configuration.yml) 1. [Annotations](columns_configuration/annotations/) - 1. [Annotations] + 1. [Annotations](columns_configuration/annotations/) 1. [Source Annotation](columns_configuration/annotations/source_annotation.md) 1. [Column Annotation for a property](columns_configuration/annotations/column_annotation_property.md) 1. [Column Annotation for a class](columns_configuration/annotations/column_annotation_class.md) @@ -51,7 +52,6 @@ SUMMARY 1. [Input Filter](columns_configuration/filters/input_filter.md) 1. [Select Filter](columns_configuration/filters/select_filter.md) 1. [Create a filter](columns_configuration/filters/create_filter.md) - 1. [YML](columns_configuration/yml/yml_configuration.yml) 1. [Grid Configuration in PHP](grid_configuration/) 1. [Set the identifier of the grid](grid_configuration/set_grid_identifier.md) 1. [Set the persistence of the grid](grid_configuration/set_grid_persistence.md) From 2280cd3a96e532cfc7a9026391ed4d47bd8d73ae Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Fri, 21 Nov 2014 17:30:53 +0100 Subject: [PATCH 18/21] YML documentation --- Resources/doc/summary.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/doc/summary.md b/Resources/doc/summary.md index 31a296c1..d6f23af6 100644 --- a/Resources/doc/summary.md +++ b/Resources/doc/summary.md @@ -22,7 +22,7 @@ SUMMARY 1. [Display a pagerfanta pager](template/render_pagerfanta_pager.md) 1. [Columns Configuration](columns_configuration/) - 1. [YML](columns_configuration/yml/yml_configuration.yml) + 1. [YML](columns_configuration/yml/yml_configuration.md) 1. [Annotations](columns_configuration/annotations/) 1. [Annotations](columns_configuration/annotations/) 1. [Source Annotation](columns_configuration/annotations/source_annotation.md) From de9408332ae3719afef4a88cb6e8d0ad2a6eed7c Mon Sep 17 00:00:00 2001 From: Dexter Morgan Date: Mon, 8 Dec 2014 15:03:20 +0100 Subject: [PATCH 19/21] generate exception if no metadata found from all drivers --- Grid/Mapping/Metadata/Manager.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Grid/Mapping/Metadata/Manager.php b/Grid/Mapping/Metadata/Manager.php index 70fad14d..2f882cce 100644 --- a/Grid/Mapping/Metadata/Manager.php +++ b/Grid/Mapping/Metadata/Manager.php @@ -76,7 +76,7 @@ public function getMetadata($className, $group = 'default') $fieldsMetadata[] = $driver->getFieldsMetadata($className, $group); $groupBy = array_merge($groupBy, $driver->getGroupBy($className, $group)); } - + $mappings = $cols = array(); foreach ($columns as $fieldName) { @@ -94,6 +94,10 @@ public function getMetadata($className, $group = 'default') } } + if (empty($cols)) { + throw new \Exception(sprintf("No metadata information has been found for %s (group : %s)", $className, $group)); + } + $metadata->setFields($cols); $metadata->setFieldsMappings($mappings); $metadata->setGroupBy($groupBy); From fce336984c9b922259c3f55ee69303bd845ae44b Mon Sep 17 00:00:00 2001 From: Dexter Morgan Date: Mon, 8 Dec 2014 15:04:53 +0100 Subject: [PATCH 20/21] generate exception if no metadata found from all drivers --- Grid/Mapping/Metadata/Manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Grid/Mapping/Metadata/Manager.php b/Grid/Mapping/Metadata/Manager.php index 2f882cce..73deb0f6 100644 --- a/Grid/Mapping/Metadata/Manager.php +++ b/Grid/Mapping/Metadata/Manager.php @@ -76,7 +76,7 @@ public function getMetadata($className, $group = 'default') $fieldsMetadata[] = $driver->getFieldsMetadata($className, $group); $groupBy = array_merge($groupBy, $driver->getGroupBy($className, $group)); } - + $mappings = $cols = array(); foreach ($columns as $fieldName) { From f3f2541a92f47179c085f0113c2ce44da153752d Mon Sep 17 00:00:00 2001 From: Nicolas Potier Date: Sun, 22 Mar 2015 13:31:25 +0100 Subject: [PATCH 21/21] remove tabs in doc --- Resources/doc/summary.md | 180 +++++++++++++++++++-------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/Resources/doc/summary.md b/Resources/doc/summary.md index d6f23af6..aab63174 100644 --- a/Resources/doc/summary.md +++ b/Resources/doc/summary.md @@ -8,100 +8,100 @@ SUMMARY 1. [Getting Started with APYDataGridBundle](getting_started.md) 1. [Source](source/) - 1. [Entity (ORM)](source/entity_source.md) - 1. [Document (ODM)](source/document_source.md) - 1. [Vector (Array)](source/vector_source.md) + 1. [Entity (ORM)](source/entity_source.md) + 1. [Document (ODM)](source/document_source.md) + 1. [Vector (Array)](source/vector_source.md) 1. [Template (Twig)](template/) - 1. [Display the grid](template/render_the_grid.md) - 1. [Display an ajax grid](template/render_an_ajax_grid.md) - 1. [Cell rendering](template/cell_rendering.md) - 1. [Filter rendering](template/filter_rendering.md) - 1. [Overriding internal blocks](template/overriding_internal_blocks.md) - 1. [Display an external filters box](template/render_external_filters.md) - 1. [Display a pagerfanta pager](template/render_pagerfanta_pager.md) + 1. [Display the grid](template/render_the_grid.md) + 1. [Display an ajax grid](template/render_an_ajax_grid.md) + 1. [Cell rendering](template/cell_rendering.md) + 1. [Filter rendering](template/filter_rendering.md) + 1. [Overriding internal blocks](template/overriding_internal_blocks.md) + 1. [Display an external filters box](template/render_external_filters.md) + 1. [Display a pagerfanta pager](template/render_pagerfanta_pager.md) 1. [Columns Configuration](columns_configuration/) - 1. [YML](columns_configuration/yml/yml_configuration.md) - 1. [Annotations](columns_configuration/annotations/) - 1. [Annotations](columns_configuration/annotations/) - 1. [Source Annotation](columns_configuration/annotations/source_annotation.md) - 1. [Column Annotation for a property](columns_configuration/annotations/column_annotation_property.md) - 1. [Column Annotation for a class](columns_configuration/annotations/column_annotation_class.md) - 1. [ORM Association Mapping](columns_configuration/annotations/association_mapping.md) - 1. [DQL Functions](columns_configuration/annotations/dql_function.md) - 1. [Column Types](columns_configuration/types/) - 1. [Text Column](columns_configuration/types/text_column.md) - 1. [Number Column](columns_configuration/types/number_column.md) - 1. [Decimal](columns_configuration/types/number_column.md) - 1. [Currency](columns_configuration/types/number_column.md) - 1. [Percent](columns_configuration/types/number_column.md) - 1. [Duration](columns_configuration/types/number_column.md) - 1. [Scientific](columns_configuration/types/number_column.md) - 1. [Spell Out](columns_configuration/types/number_column.md) - 1. [Boolean Column](columns_configuration/types/boolean_column.md) - 1. [DateTime Column](columns_configuration/types/datetime_column.md) - 1. [Date Column](columns_configuration/types/date_column.md) - 1. [_Time_](columns_configuration/types/time_column.md) - 1. [Array Column](columns_configuration/types/array_column.md) - 1. [Blank Column](columns_configuration/types/blank_column.md) - 1. [Rank Column](columns_configuration/types/rank_column.md) - 1. [Join Column](columns_configuration/types/join_column.md) - 1. [Create your column](columns_configuration/types/create_column.md) - 1. [Filters](columns_configuration/filters/) - 1. [Input Filter](columns_configuration/filters/input_filter.md) - 1. [Select Filter](columns_configuration/filters/select_filter.md) - 1. [Create a filter](columns_configuration/filters/create_filter.md) + 1. [YML](columns_configuration/yml/yml_configuration.md) + 1. [Annotations](columns_configuration/annotations/) + 1. [Annotations](columns_configuration/annotations/) + 1. [Source Annotation](columns_configuration/annotations/source_annotation.md) + 1. [Column Annotation for a property](columns_configuration/annotations/column_annotation_property.md) + 1. [Column Annotation for a class](columns_configuration/annotations/column_annotation_class.md) + 1. [ORM Association Mapping](columns_configuration/annotations/association_mapping.md) + 1. [DQL Functions](columns_configuration/annotations/dql_function.md) + 1. [Column Types](columns_configuration/types/) + 1. [Text Column](columns_configuration/types/text_column.md) + 1. [Number Column](columns_configuration/types/number_column.md) + 1. [Decimal](columns_configuration/types/number_column.md) + 1. [Currency](columns_configuration/types/number_column.md) + 1. [Percent](columns_configuration/types/number_column.md) + 1. [Duration](columns_configuration/types/number_column.md) + 1. [Scientific](columns_configuration/types/number_column.md) + 1. [Spell Out](columns_configuration/types/number_column.md) + 1. [Boolean Column](columns_configuration/types/boolean_column.md) + 1. [DateTime Column](columns_configuration/types/datetime_column.md) + 1. [Date Column](columns_configuration/types/date_column.md) + 1. [_Time_](columns_configuration/types/time_column.md) + 1. [Array Column](columns_configuration/types/array_column.md) + 1. [Blank Column](columns_configuration/types/blank_column.md) + 1. [Rank Column](columns_configuration/types/rank_column.md) + 1. [Join Column](columns_configuration/types/join_column.md) + 1. [Create your column](columns_configuration/types/create_column.md) + 1. [Filters](columns_configuration/filters/) + 1. [Input Filter](columns_configuration/filters/input_filter.md) + 1. [Select Filter](columns_configuration/filters/select_filter.md) + 1. [Create a filter](columns_configuration/filters/create_filter.md) 1. [Grid Configuration in PHP](grid_configuration/) - 1. [Set the identifier of the grid](grid_configuration/set_grid_identifier.md) - 1. [Set the persistence of the grid](grid_configuration/set_grid_persistence.md) - 1. [Pagination](grid_configuration/set_limits.md) - 1. [Set max results](grid_configuration/set_max_results.md) - 1. [Add column](grid_configuration/add_column.md) - 1. [Add row action](grid_configuration/add_row_action.md) - 1. [Add multiple row actions columns](grid_configuration/add_actions_column.md) - 1. [Add mass action](grid_configuration/add_mass_action.md) - 1. [Add a native delete mass action](grid_configuration/add_delete_mass_action.md) - 1. [Add export](grid_configuration/add_export.md) - 1. [Manipulate rows data](grid_configuration/manipulate_rows_data.md) - 1. [Manipulate column render cell](grid_configuration/manipulate_column_render_cell.md) - 1. [Manipulate the source query](grid_configuration/manipulate_query.md) - 1. [Manipulate columns](grid_configuration/manipulate_column.md) - 1. [Manipulate row action rendering](grid_configuration/manipulate_row_action_rendering.md) - 1. [Hide or show columns](grid_configuration/hide_show_columns.md) - 1. [Set columns order](grid_configuration/set_columns_order.md) - 1. [Set a default page](grid_configuration/set_default_page.md) - 1. [Set a default order](grid_configuration/set_default_order.md) - 1. [Set a default items per page](grid_configuration/set_default_limit.md) - 1. [Set default filters](grid_configuration/set_default_filters.md) - 1. [Set permanent filters](grid_configuration/set_permanent_filters.md) - 1. [Set the no data message](grid_configuration/set_no_data_message.md) - 1. [Set the no result message](grid_configuration/set_no_result_message.md) - 1. [Always show the grid](grid_configuration/always_show_grid.md) - 1. [Set a title prefix](grid_configuration/set_prefix_titles.md) - 1. [Set the size of the actions colum](grid_configuration/set_size_actions_column.md) - 1. [Set the title of the actions colum](grid_configuration/set_title_actions_column.md) - 1. [Set data to avoid calling the database](grid_configuration/set_data.md) - 1. [Grid Response helper](grid_configuration/grid_response.md) - 1. [Multi Grid manager](grid_configuration/multi_grid_manager.md) - 1. [Set the route of the grid](grid_configuration/set_grid_route.md) - 1. [Working Example](grid_configuration/working_example.md) + 1. [Set the identifier of the grid](grid_configuration/set_grid_identifier.md) + 1. [Set the persistence of the grid](grid_configuration/set_grid_persistence.md) + 1. [Pagination](grid_configuration/set_limits.md) + 1. [Set max results](grid_configuration/set_max_results.md) + 1. [Add column](grid_configuration/add_column.md) + 1. [Add row action](grid_configuration/add_row_action.md) + 1. [Add multiple row actions columns](grid_configuration/add_actions_column.md) + 1. [Add mass action](grid_configuration/add_mass_action.md) + 1. [Add a native delete mass action](grid_configuration/add_delete_mass_action.md) + 1. [Add export](grid_configuration/add_export.md) + 1. [Manipulate rows data](grid_configuration/manipulate_rows_data.md) + 1. [Manipulate column render cell](grid_configuration/manipulate_column_render_cell.md) + 1. [Manipulate the source query](grid_configuration/manipulate_query.md) + 1. [Manipulate columns](grid_configuration/manipulate_column.md) + 1. [Manipulate row action rendering](grid_configuration/manipulate_row_action_rendering.md) + 1. [Hide or show columns](grid_configuration/hide_show_columns.md) + 1. [Set columns order](grid_configuration/set_columns_order.md) + 1. [Set a default page](grid_configuration/set_default_page.md) + 1. [Set a default order](grid_configuration/set_default_order.md) + 1. [Set a default items per page](grid_configuration/set_default_limit.md) + 1. [Set default filters](grid_configuration/set_default_filters.md) + 1. [Set permanent filters](grid_configuration/set_permanent_filters.md) + 1. [Set the no data message](grid_configuration/set_no_data_message.md) + 1. [Set the no result message](grid_configuration/set_no_result_message.md) + 1. [Always show the grid](grid_configuration/always_show_grid.md) + 1. [Set a title prefix](grid_configuration/set_prefix_titles.md) + 1. [Set the size of the actions colum](grid_configuration/set_size_actions_column.md) + 1. [Set the title of the actions colum](grid_configuration/set_title_actions_column.md) + 1. [Set data to avoid calling the database](grid_configuration/set_data.md) + 1. [Grid Response helper](grid_configuration/grid_response.md) + 1. [Multi Grid manager](grid_configuration/multi_grid_manager.md) + 1. [Set the route of the grid](grid_configuration/set_grid_route.md) + 1. [Working Example](grid_configuration/working_example.md) 1. [Export](export/) - 1. [Native exports](export/native_exports/) - 1. [DSV - Delimiter-Separated Values](export/native_exports/DSV_export.md) - 1. [CSV - Comma-Separated Values](export/native_exports/CSV_export.md) - 1. [SCSV - SemiColon-Separated Values](export/native_exports/SCSV_export.md) - 1. [TSV - Tab-Separated Values](export/native_exports/TSV_export.md) - 1. [_Excel_](export/native_exports/Excel_export.md) - 1. [XML](export/native_exports/XML_export.md) - 1. [JSON](export/native_exports/JSON_export.md) - 1. [Library-dependent exports](export/library-dependent_exports/) - 1. [PHPExcel](export/library-dependent_exports/PHPExcel/) - 1. [Installation](export/library-dependent_exports/PHPExcel/PHPExcel_installation.md) - 1. [Excel 5 (97-2003) (.xls)](export/library-dependent_exports/PHPExcel/PHPExcel_excel5_export.md) - 1. [Excel 2003 (.xlsx)](export/library-dependent_exports/PHPExcel/PHPExcel_excel2003_export.md) - 1. [Excel 2007 (.xlsx)](export/library-dependent_exports/PHPExcel/PHPExcel_excel2007_export.md) - 1. [Simple HTML](export/library-dependent_exports/PHPExcel/PHPExcel_HTML_export.md) - 1. [PDF (Not working!)](export/library-dependent_exports/PHPExcel/PHPExcel_PDF_export.md) - 1. [Create your export class](export/create_export.md) + 1. [Native exports](export/native_exports/) + 1. [DSV - Delimiter-Separated Values](export/native_exports/DSV_export.md) + 1. [CSV - Comma-Separated Values](export/native_exports/CSV_export.md) + 1. [SCSV - SemiColon-Separated Values](export/native_exports/SCSV_export.md) + 1. [TSV - Tab-Separated Values](export/native_exports/TSV_export.md) + 1. [_Excel_](export/native_exports/Excel_export.md) + 1. [XML](export/native_exports/XML_export.md) + 1. [JSON](export/native_exports/JSON_export.md) + 1. [Library-dependent exports](export/library-dependent_exports/) + 1. [PHPExcel](export/library-dependent_exports/PHPExcel/) + 1. [Installation](export/library-dependent_exports/PHPExcel/PHPExcel_installation.md) + 1. [Excel 5 (97-2003) (.xls)](export/library-dependent_exports/PHPExcel/PHPExcel_excel5_export.md) + 1. [Excel 2003 (.xlsx)](export/library-dependent_exports/PHPExcel/PHPExcel_excel2003_export.md) + 1. [Excel 2007 (.xlsx)](export/library-dependent_exports/PHPExcel/PHPExcel_excel2007_export.md) + 1. [Simple HTML](export/library-dependent_exports/PHPExcel/PHPExcel_HTML_export.md) + 1. [PDF (Not working!)](export/library-dependent_exports/PHPExcel/PHPExcel_PDF_export.md) + 1. [Create your export class](export/create_export.md)