# Introduction Prometeo Commands is a symfony bundle that allows you to build automatically entities, sonata admins, unit test cases, functional test cases and user documentation. A demo site? ## Installation ### Minimum requirements - Symfony 4.0 - PHP 7.1.3 - Twig 2.0 ### Composer installation You can install it through composer. ```json { .... "require":{ "prometeo/prometeo-command": "@dev" } .... "repositories": [ { "type": "path", "url": "repositories/prometeo-commands", "options": { "symlink": true } } ], .... } ``` ### Enable bundle Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project: ```php ['all' => true], ]; ``` ### Add services Add to services.yml ```yaml prometeo.admin.maker: class: Prometeo\CommandsBundle\Commands\MakeAdmin arguments: - '@doctrine.orm.entity_manager' - collection: - maker.command tags: - { name: 'admin.maker.command', command: 'prometeo:make:admin' } prometeo.entities.maker: class: Prometeo\CommandsBundle\Commands\MakeEntities arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager', ['maker.command']] tags: - { name: 'entities.maker.command', command: 'prometeo:make:entities' } prometeo.usermanual.maker: class: Prometeo\CommandsBundle\Commands\MakeUserManual arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager'] tags: - { name: 'usermanual.maker.command', command: 'prometeo:make:entities' } prometeo.skipper.generate: class: Prometeo\CommandsBundle\Commands\GenerateSkipper arguments: ["@service_container",'%kernel.project_dir%','@doctrine.orm.entity_manager'] tags: - { name: 'skipper.generate.command', command: 'prometeo:skipper:generate' } prometeo.screenshots.generate: class: Prometeo\CommandsBundle\Commands\GenerateScreenshoots arguments: ["@service_container",'%kernel.project_dir%','@doctrine.orm.entity_manager'] tags: - { name: 'screenshots.generate.command', command: 'prometeo:screenshots:generate' } prometeo.unittest.maker: class: Prometeo\CommandsBundle\Commands\MakeUnitTest arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager'] tags: - { name: 'screenshots.generate.command', command: 'prometeo:make:unit-test' } prometeo.functionaltest.make: class: Prometeo\CommandsBundle\Commands\MakeFunctionalTest arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager'] tags: - { name: 'screenshots.generate.command', command: 'prometeo:make:functional-test' } ``` ### PHPunit config ``` tests ``` # Usage ## How to use #### Make entities ```shell script cd src/Entity for file in *; do echo "../../bin/console make:entity App\\Entity\\${file::-4}"; ../../bin/console make:entity --regenerate --overwrite "App\\Entity\\${file::-4}"; done ``` #### Make Sonata Admins ```shell script cd src/Entity for file in *; do withoutext=${file::-4} echo "../../bin/console make:sonata:admin \"App\\Entity\\${file::-4}\" --admin ${file::-4}Admin --controller ${file::-4}AdminController --services services.yaml --id admin.${withoutext,,}"; ../../bin/console make:sonata:admin \"App\\Entity\\${file::-4}\" --admin ${file::-4}Admin --controller ${file::-4}AdminController --services services.yaml --id admin.${withoutext,,} done ``` #### Generate Screen Shoots ```shell script bin/console debug:router --raw >adminlist.txt php filterlist.php ./phantomjs.exe --ssl-protocol=any --ignore-ssl-errors=yes phantomjs/testscripts/sonatatest.js acdr.test %1 %2 %3 ``` #### Make Unit Test ```shell script cd src/Entity for file in *; do echo "../../bin/console prometeo:make:unit-test Entity\\${file::-4} Entity"; ../../bin/console prometeo:make:unit-test "Entity\\${file::-4}" Entity done ``` #### Make Functional Test #### Make User Manual That's it! Done! ## Additional documentation: