@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use Symfony\Component\Console\Input\InputInterface; |
| 9 | 9 | use Symfony\Component\Console\Input\InputOption; |
| 10 | 10 | use Symfony\Component\Console\Output\OutputInterface; |
| 11 | -use Tpg\ExtjsBundle\Service\GeneratorService; |
|
| 12 | 11 | |
| 13 | 12 | class GenerateEntityCommand extends ContainerAwareCommand { |
| 14 | 13 | public function configure() { |
@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Tpg\ExtjsBundle\Generator; |
| 3 | 3 | |
| 4 | -use Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver; |
|
| 5 | 4 | use Sensio\Bundle\GeneratorBundle\Generator\ControllerGenerator; |
| 6 | 5 | use Symfony\Component\HttpKernel\Bundle\BundleInterface; |
| 7 | 6 | use Symfony\Component\Yaml\Yaml; |
@@ -3,16 +3,9 @@ |
||
| 3 | 3 | |
| 4 | 4 | include_once(__DIR__ . '/../app/AppKernel.php'); |
| 5 | 5 | |
| 6 | -use Doctrine\Bundle\MongoDBBundle\Command\CreateSchemaDoctrineODMCommand; |
|
| 7 | -use Doctrine\Bundle\MongoDBBundle\Command\DropSchemaDoctrineODMCommand; |
|
| 8 | 6 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
| 9 | -use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand; |
|
| 10 | -use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand; |
|
| 11 | -use Doctrine\Bundle\DoctrineBundle\Command\Proxy\CreateSchemaDoctrineCommand; |
|
| 12 | - |
|
| 13 | 7 | use Symfony\Bundle\FrameworkBundle\Console\Application; |
| 14 | 8 | use Symfony\Component\Console\Tester\CommandTester; |
| 15 | -use Symfony\Component\Routing\Router; |
|
| 16 | 9 | use Tpg\ExtjsBundle\Command\GenerateRestControllerCommand; |
| 17 | 10 | |
| 18 | 11 | class BaseTestGeneratedRestController extends WebTestCase { |
@@ -21,19 +21,19 @@ |
||
| 21 | 21 | $this->twigEngine = new TwigEngineMokcup(); |
| 22 | 22 | $this->service->setTwigEngine($this->twigEngine); |
| 23 | 23 | $this->service->setModelFieldsParameters(array( |
| 24 | - "date" => array( "format" => "d-m-y") |
|
| 24 | + "date" => array( "format" => "d-m-y") |
|
| 25 | 25 | )); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function testCustomFieldParameters() { |
| 29 | - $this->service->generateMarkupForEntity('Test\TestBundle\Model\Person'); |
|
| 30 | - $fieldsType = array(); |
|
| 31 | - foreach ($this->twigEngine->renderParameters['fields'] as $field) { |
|
| 29 | + $this->service->generateMarkupForEntity('Test\TestBundle\Model\Person'); |
|
| 30 | + $fieldsType = array(); |
|
| 31 | + foreach ($this->twigEngine->renderParameters['fields'] as $field) { |
|
| 32 | 32 | if (isset($field['format'])) { |
| 33 | - $fieldsType[$field['name']] = $field['format']; |
|
| 33 | + $fieldsType[$field['name']] = $field['format']; |
|
| 34 | + } |
|
| 34 | 35 | } |
| 35 | - } |
|
| 36 | - $this->assertEquals("d-m-y", $fieldsType['createdAt']); |
|
| 36 | + $this->assertEquals("d-m-y", $fieldsType['createdAt']); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function testEntityProperty() { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | break; |
| 261 | 261 | case 'Doctrine\ORM\Mapping\JoinColumns': |
| 262 | 262 | if (count($annotation->value) > 1) { |
| 263 | - throw new \Exception('Multiple foreign key is not supported'); |
|
| 263 | + throw new \Exception('Multiple foreign key is not supported'); |
|
| 264 | 264 | } |
| 265 | 265 | $saveField = true; |
| 266 | 266 | $field['name'] = $this->convertNaming($annotation->value[0]->name); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | /** Add the ability to override field parameter */ |
| 286 | 286 | if (isset($this->fieldsParams[$field['type']])) { |
| 287 | - $field = array_merge($field, $this->fieldsParams[$field['type']]); |
|
| 287 | + $field = array_merge($field, $this->fieldsParams[$field['type']]); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if (!empty($association)) { |
@@ -30,12 +30,12 @@ |
||
| 30 | 30 | |
| 31 | 31 | class |
| 32 | 32 | {%- endif %} |
| 33 | - {{ controller }}Controller |
|
| 33 | + {{ controller }}Controller |
|
| 34 | 34 | {%- if not trait %} |
| 35 | - extends FOSRestController |
|
| 35 | + extends FOSRestController |
|
| 36 | 36 | {%- endif %} |
| 37 | 37 | {% endblock class_definition %} |
| 38 | - { |
|
| 38 | + { |
|
| 39 | 39 | {% block class_body %} |
| 40 | 40 | /** |
| 41 | 41 | * Get detail of a {{ entity_name }} record |