@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * |
| 20 | 20 | * @param BundleInterface $bundle |
| 21 | - * @param type $entity |
|
| 21 | + * @param string $entity |
|
| 22 | 22 | * @param ClassMetadataInfo $metadata |
| 23 | 23 | * @param Configuration $config |
| 24 | 24 | * @throws RuntimeException |
@@ -160,7 +160,6 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | /** |
| 162 | 162 | * Generates the controller class only. |
| 163 | - * @param boolean $config->getOverwrite() |
|
| 164 | 163 | */ |
| 165 | 164 | protected function generateCrudControllerClass() { |
| 166 | 165 | $dir = $this->bundle->getPath(); |
@@ -197,6 +197,9 @@ |
||
| 197 | 197 | $this->assertContains($expected, file_get_contents($rootDir . '/config/routing.yml')); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | + /** |
|
| 201 | + * @return \Symfony\Component\Console\Command\Command |
|
| 202 | + */ |
|
| 200 | 203 | protected function getCommand($generator, $input) |
| 201 | 204 | { |
| 202 | 205 | $command = $this |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Petkopara\CrudGeneratorBundle\Configuration\Configuration; |
| 6 | 6 | use Sensio\Bundle\GeneratorBundle\Tests\Command\GenerateCommandTest; |
| 7 | 7 | use Symfony\Component\Console\Tester\CommandTester; |
| 8 | -use Symfony\Component\Filesystem\Filesystem; |
|
| 9 | 8 | |
| 10 | 9 | /* |
| 11 | 10 | * This file is part of the CrudGeneratorBundle |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | return array( |
| 56 | 56 | array(array(), "AcmeBlogBundle:Blog/Post\nn\ninput\nbase.html.twig\nannotation\n/foobar\n\n", array('Blog\\Post', false, 'input', 'base.html.twig', 'annotation', 'foobar', false, false, false, false, false, false)), |
| 57 | - array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--bundle-views'=> true), '', array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', false, false, false, false, true,false)), |
|
| 57 | + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--bundle-views'=> true), '', array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', false, false, false, false, true, false)), |
|
| 58 | 58 | array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--template'=> 'base.html.twig', '--filter-type'=>'none'), '', array('Blog\\Post', false, 'none', 'base.html.twig', 'annotation', 'blog_post', false, false, false, false, false, false)), |
| 59 | - array(array(), "AcmeBlogBundle:Blog/Post\nn\nform\nbase.html.twig\nyml\n/foobar\n\n", array('Blog\\Post', false, 'form', 'base.html.twig', 'yml', 'foobar', false, false, false, false,false, false)), |
|
| 60 | - array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--without-write' => true, '--filter-type' => 'input'), '', array('Blog\\Post', true, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'yml', 'foo', false, false, false, false,false, false)), |
|
| 61 | - array(array('--without-show' => true, '--without-bulk' => true,), "AcmeBlogBundle:Blog/Post\nn\ninput\nbase.html.twig\nannotation\n/foobar\n\n", array('Blog\\Post', false, 'input', 'base.html.twig', 'annotation', 'foobar', true, true, false, false, false,false)), |
|
| 62 | - array(array('--without-sorting' => true, '--without-page-size' => true, '--bundle-views'=> true), "AcmeBlogBundle:Blog/Post\nn\ninput\nbase.html.twig\nannotation\n/foobar\n\n", array('Blog\\Post', false, 'input', 'base.html.twig', 'annotation', 'foobar', false, false, true, true, true,false)), |
|
| 63 | - array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--overwrite'=> true,'--without-sorting' => true, '--without-page-size' => true, '--without-show' => true, '--without-bulk' => true,), '', array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', true, true, true, true, false, true)), |
|
| 59 | + array(array(), "AcmeBlogBundle:Blog/Post\nn\nform\nbase.html.twig\nyml\n/foobar\n\n", array('Blog\\Post', false, 'form', 'base.html.twig', 'yml', 'foobar', false, false, false, false, false, false)), |
|
| 60 | + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--without-write' => true, '--filter-type' => 'input'), '', array('Blog\\Post', true, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'yml', 'foo', false, false, false, false, false, false)), |
|
| 61 | + array(array('--without-show' => true, '--without-bulk' => true,), "AcmeBlogBundle:Blog/Post\nn\ninput\nbase.html.twig\nannotation\n/foobar\n\n", array('Blog\\Post', false, 'input', 'base.html.twig', 'annotation', 'foobar', true, true, false, false, false, false)), |
|
| 62 | + array(array('--without-sorting' => true, '--without-page-size' => true, '--bundle-views'=> true), "AcmeBlogBundle:Blog/Post\nn\ninput\nbase.html.twig\nannotation\n/foobar\n\n", array('Blog\\Post', false, 'input', 'base.html.twig', 'annotation', 'foobar', false, false, true, true, true, false)), |
|
| 63 | + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--overwrite'=> true, '--without-sorting' => true, '--without-page-size' => true, '--without-show' => true, '--without-bulk' => true,), '', array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', true, true, true, true, false, true)), |
|
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | public function getNonInteractiveCommandData() |
| 97 | 97 | { |
| 98 | 98 | return array( |
| 99 | - array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', false, false, false, false, false, false)), |
|
| 100 | - array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--filter-type'=> 'form', '--bundle-views'=> true, '--template'=> 'base.html.twig'), array('Blog\\Post', false, 'form', 'base.html.twig', 'annotation', 'blog_post', false, false, false, false, true, false)), |
|
| 101 | - array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--without-write' => true), array('Blog\\Post', true, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'yml', 'foo', false, false, false, false, false, false)), |
|
| 102 | - array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--without-show' => true, '--without-bulk' => true,'--without-sorting' => true, '--without-page-size' => true), array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', true, true, true, true, false, false)), |
|
| 99 | + array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', false, false, false, false, false, false)), |
|
| 100 | + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--filter-type'=> 'form', '--bundle-views'=> true, '--template'=> 'base.html.twig'), array('Blog\\Post', false, 'form', 'base.html.twig', 'annotation', 'blog_post', false, false, false, false, true, false)), |
|
| 101 | + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--without-write' => true), array('Blog\\Post', true, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'yml', 'foo', false, false, false, false, false, false)), |
|
| 102 | + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--without-show' => true, '--without-bulk' => true, '--without-sorting' => true, '--without-page-size' => true), array('Blog\\Post', false, 'input', 'PetkoparaCrudGeneratorBundle::base.html.twig', 'annotation', 'blog_post', true, true, true, true, false, false)), |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -61,6 +61,9 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | + /** |
|
| 65 | + * @param boolean $overwrite |
|
| 66 | + */ |
|
| 64 | 67 | private function generateFormFilter($overwrite) |
| 65 | 68 | { |
| 66 | 69 | |
@@ -70,6 +73,9 @@ discard block |
||
| 70 | 73 | $generator->generate($bundle, 'Post', $metadata, $overwrite, CrudGeneratorCommand::FILTER_TYPE_FORM); |
| 71 | 74 | } |
| 72 | 75 | |
| 76 | + /** |
|
| 77 | + * @param boolean $overwrite |
|
| 78 | + */ |
|
| 73 | 79 | private function generateMultiSearchFilter($overwrite) |
| 74 | 80 | { |
| 75 | 81 | $generator = $this->getFilterGenerator(); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | $filterType = strtolower($filterType); |
| 18 | 18 | |
| 19 | - if($filterType==1){//set to default value |
|
| 19 | + if ($filterType == 1) {//set to default value |
|
| 20 | 20 | $filterType = CrudGeneratorCommand::FILTER_TYPE_FORM; |
| 21 | 21 | } |
| 22 | 22 | // in case they typed "no", but ok with that |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Petkopara\CrudGeneratorBundle\Generator; |
| 4 | 4 | |
| 5 | -use Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory; |
|
| 6 | 5 | use Doctrine\ORM\Mapping\ClassMetadataInfo; |
| 7 | 6 | use Petkopara\CrudGeneratorBundle\Command\CrudGeneratorCommand; |
| 8 | 7 | use Petkopara\CrudGeneratorBundle\Generator\Guesser\MetadataGuesser; |
@@ -20,10 +20,10 @@ |
||
| 20 | 20 | private $classPath; |
| 21 | 21 | private $metadataGuesser; |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * |
|
| 25 | - * @param MetadataGuesser $guesser |
|
| 26 | - */ |
|
| 23 | + /** |
|
| 24 | + * |
|
| 25 | + * @param MetadataGuesser $guesser |
|
| 26 | + */ |
|
| 27 | 27 | public function __construct(MetadataGuesser $guesser) |
| 28 | 28 | { |
| 29 | 29 | $this->metadataGuesser = $guesser; |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | // Convert type to filter widget |
| 110 | 110 | foreach ($fieldsData as $fieldName => $data) { |
| 111 | 111 | $fieldWidget = $this->getFilterType($fieldsData[$fieldName]['type'], $fieldName); |
| 112 | - if ($fieldWidget!== false) { |
|
| 112 | + if ($fieldWidget !== false) { |
|
| 113 | 113 | $fieldsResult[$fieldName]['fieldName'] = $fieldName; |
| 114 | 114 | $fieldsResult[$fieldName]['filterWidget'] = $this->getFilterType($fieldsData[$fieldName]['type'], $fieldName); |
| 115 | 115 | } |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Petkopara\CrudGeneratorBundle\Generator; |
| 4 | 4 | |
| 5 | -use Doctrine\Bundle\DoctrineBundle\Mapping\DisconnectedMetadataFactory; |
|
| 6 | 5 | use Doctrine\ORM\Mapping\ClassMetadataInfo; |
| 7 | 6 | use Petkopara\CrudGeneratorBundle\Generator\Guesser\MetadataGuesser; |
| 8 | 7 | use RuntimeException; |