├── .github └── workflows │ └── phpunit.yml ├── .gitignore ├── .php_cs ├── .scrutinizer.yml ├── AdmingeneratorGeneratorBundle.php ├── Builder ├── Admin │ ├── ActionsBuilder.php │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── BaseBuilder.php │ ├── EditBuilder.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── EmptyBuilderAction.php │ ├── ExcelBuilder.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilderType.php │ ├── ListBuilder.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NestedListBuilder.php │ ├── NestedListBuilderAction.php │ ├── NestedListBuilderTemplate.php │ ├── NewBuilder.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilder.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── BaseBuilder.php ├── Doctrine │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilderType.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NestedListBuilderAction.php │ ├── NestedListBuilderTemplate.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── DoctrineODM │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilderType.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── EmptyGenerator.php ├── Generator.php └── Propel │ ├── ActionsBuilderAction.php │ ├── ActionsBuilderTemplate.php │ ├── EditBuilderAction.php │ ├── EditBuilderTemplate.php │ ├── EditBuilderType.php │ ├── ExcelBuilderAction.php │ ├── FiltersBuilderType.php │ ├── ListBuilderAction.php │ ├── ListBuilderTemplate.php │ ├── NestedListBuilderAction.php │ ├── NestedListBuilderTemplate.php │ ├── NewBuilderAction.php │ ├── NewBuilderTemplate.php │ ├── NewBuilderType.php │ ├── ShowBuilderAction.php │ └── ShowBuilderTemplate.php ├── CONTRIBUTING.md ├── CacheBuilder ├── EmptyCacheGenerator.php └── GeneratorCacheBuilder.php ├── CacheWarmer └── GeneratorCacheWarmer.php ├── ClassLoader └── AdmingeneratedClassLoader.php ├── Command ├── AssetsInstallCommand.php └── GenerateBaseClassesCommand.php ├── Composer └── ScriptHandler.php ├── Controller ├── AdminBaseController.php ├── Doctrine │ └── BaseController.php ├── DoctrineODM │ └── BaseController.php └── Propel │ └── BaseController.php ├── DependencyInjection ├── AdmingeneratorGeneratorExtension.php ├── Compiler │ ├── FormPass.php │ ├── RemoveMakerCommandPass.php │ ├── TwigLoaderPass.php │ └── ValidatorPass.php └── Configuration.php ├── EventListener └── ControllerListener.php ├── Exception ├── CantGenerateException.php ├── GeneratedModelClassNotFoundException.php ├── InvalidOptionException.php ├── ModelClassNotFoundException.php ├── ModelManagerNotSelectedException.php ├── NotAdminGeneratedException.php ├── NotImplementedException.php └── ValidationException.php ├── Filesystem ├── GeneratorsFinder.php └── RelativePathComputer.php ├── Form └── BaseType.php ├── Generator ├── Action.php ├── Action │ ├── Batch │ │ └── DeleteAction.php │ ├── Generic │ │ ├── ExcelAction.php │ │ ├── ListAction.php │ │ ├── NewAction.php │ │ ├── SaveAction.php │ │ ├── SaveAndAddAction.php │ │ ├── SaveAndListAction.php │ │ └── SaveAndShowAction.php │ └── Object │ │ ├── DeleteAction.php │ │ ├── EditAction.php │ │ └── ShowAction.php ├── Column.php ├── DoctrineGenerator.php ├── DoctrineODMGenerator.php ├── Generator.php ├── GeneratorInterface.php ├── PropelColumn.php └── PropelGenerator.php ├── Guesser ├── DoctrineFieldGuesser.php ├── DoctrineODMFieldGuesser.php ├── DoctrineORMFieldGuesser.php ├── FieldGuesser.php └── PropelORMFieldGuesser.php ├── LICENSE ├── Maker └── MakeAdmin.php ├── Menu ├── AdmingeneratorMenuBuilder.php └── DefaultMenuBuilder.php ├── Pagerfanta └── View │ └── AdmingeneratorView.php ├── QueryFilter ├── BaseQueryFilter.php ├── DoctrineODMQueryFilter.php ├── DoctrineQueryFilter.php ├── PropelQueryFilter.php └── QueryFilterInterface.php ├── README.md ├── Resources ├── config │ ├── default.yml │ ├── doctrine_odm.xml │ ├── doctrine_orm.xml │ ├── propel.xml │ └── services.xml ├── doc │ ├── admin │ │ ├── actions.md │ │ ├── builder-edit.md │ │ ├── builder-excel.md │ │ ├── builder-filter.md │ │ ├── builder-list.md │ │ ├── builder-show.md │ │ ├── builders.md │ │ ├── fields.md │ │ ├── general-params.md │ │ ├── images │ │ │ ├── list-filters-collapsed-top-position-preview.png │ │ │ ├── list-filters-default-position-preview.png │ │ │ ├── list-filters-modal-large-preview.png │ │ │ ├── list-filters-modal-list-preview.png │ │ │ ├── list-filters-modal-medium-preview.png │ │ │ ├── list-filters-modal-small-preview.png │ │ │ └── list-filters-top-position-preview.png │ │ └── security.md │ ├── cookbook │ │ ├── a2lix-translations.md │ │ ├── breadcrumbs.md │ │ ├── custom-avatars.md │ │ ├── images │ │ │ ├── a2lix-integrations.png │ │ │ ├── breadcrumbs.png │ │ │ ├── console-example.png │ │ │ └── modal-with-field.jpg │ │ ├── inject-services-into-form-types.md │ │ ├── knp-menu.md │ │ ├── modal-with-fields.md │ │ ├── multiple-entity-managers.md │ │ └── view-parameters.md │ ├── customization │ │ ├── actions.md │ │ ├── forms.md │ │ └── templates.md │ ├── documentation.md │ ├── getting-started │ │ ├── create-admin.md │ │ └── internationalization.md │ ├── img │ │ ├── branching-model.png │ │ └── showcase │ │ │ ├── dashboard-adminlte-preview.png │ │ │ ├── edit-form.png │ │ │ ├── edit-preview.png │ │ │ ├── list-preview.png │ │ │ ├── list-with-filter.png │ │ │ ├── list-with-scopes--scoped.png │ │ │ ├── list-with-scopes.png │ │ │ ├── list.png │ │ │ └── nestedlist-preview.png │ ├── install │ │ ├── base-installation.md │ │ ├── form_types │ │ │ ├── doctrine_odm.md │ │ │ ├── doctrine_orm.md │ │ │ ├── overview.md │ │ │ └── propel.md │ │ └── general-configuration.md │ └── support-and-contribution │ │ ├── contributing.md │ │ └── submitting-issues.md ├── public │ ├── css │ │ └── main.css │ ├── ico │ │ ├── admingenerator_gravatar.png │ │ ├── apple-touch-icon-114-precomposed.png │ │ ├── apple-touch-icon-144-precomposed.png │ │ ├── apple-touch-icon-57-precomposed.png │ │ ├── apple-touch-icon-72-precomposed.png │ │ └── favicon.ico │ ├── img │ │ ├── unauthenticated.gif │ │ └── unauthenticated.png │ └── js │ │ └── main.js ├── skeleton │ ├── config │ │ └── yml_generator.tpl.php │ ├── controller │ │ └── controller_generator.tpl.php │ ├── form │ │ ├── options_generator.tpl.php │ │ └── type_generator.tpl.php │ └── template │ │ └── twig_generator.tpl.php ├── translations │ ├── Admingenerator.de.yml │ ├── Admingenerator.el.yml │ ├── Admingenerator.en.yml │ ├── Admingenerator.es.yml │ ├── Admingenerator.fa.yml │ ├── Admingenerator.fr.yml │ ├── Admingenerator.it.yml │ ├── Admingenerator.ja.yml │ ├── Admingenerator.nl.yml │ ├── Admingenerator.pl.yml │ ├── Admingenerator.pt.yml │ ├── Admingenerator.ro.yml │ ├── Admingenerator.ru.yml │ ├── Admingenerator.sl.yml │ ├── Admingenerator.tr.yml │ └── Admingenerator.uk.yml └── views │ ├── KnpMenu │ └── knp_menu_trans.html.twig │ ├── Navbar │ ├── authenticated.html.twig │ ├── avatar_source.html.twig │ ├── layout.html.twig │ └── not_authenticated.html.twig │ ├── Sidebar │ ├── authenticated.html.twig │ ├── avatar_source.html.twig │ ├── layout.html.twig │ └── not_authenticated.html.twig │ ├── base.html.twig │ ├── flash.html.twig │ ├── header.html.twig │ └── templates │ ├── CommonAdmin │ ├── ActionsAction │ │ ├── ActionsBuilderAction.php.twig │ │ ├── batch_action.php.twig │ │ ├── batch_delete.php.twig │ │ ├── object_action.php.twig │ │ └── object_delete.php.twig │ ├── ActionsTemplate │ │ ├── ActionsBuilderTemplate.php.twig │ │ ├── form.php.twig │ │ └── title.php.twig │ ├── EditAction │ │ ├── EditBuilderAction.php.twig │ │ ├── index.php.twig │ │ └── update.php.twig │ ├── EditTemplate │ │ ├── EditBuilderTemplate.php.twig │ │ ├── FormBuilderTemplate.php.twig │ │ └── fieldsets.php.twig │ ├── EditType │ │ ├── EditBuilderType.php.twig │ │ └── type.php.twig │ ├── ExcelAction │ │ └── ExcelBuilderAction.php.twig │ ├── FiltersType │ │ ├── FiltersBuilderType.php.twig │ │ └── type.php.twig │ ├── ListAction │ │ ├── ListBuilderAction.php.twig │ │ ├── filters.php.twig │ │ ├── index.php.twig │ │ ├── pager.php.twig │ │ ├── scopes.php.twig │ │ └── sorter.php.twig │ ├── ListTemplate │ │ ├── FiltersBuilderTemplate.php.twig │ │ ├── ListBuilderTemplate.php.twig │ │ ├── ResultsBuilderTemplate.php.twig │ │ ├── RowBuilderTemplate.php.twig │ │ ├── column.php.twig │ │ ├── footer.php.twig │ │ ├── form.php.twig │ │ ├── nbresults.php.twig │ │ ├── paginator.php.twig │ │ ├── row.php.twig │ │ ├── scopes.php.twig │ │ ├── tbody.php.twig │ │ └── thead.php.twig │ ├── NestedListAction │ │ ├── NestedListBuilderAction.php.twig │ │ └── index.php.twig │ ├── NestedListTemplate │ │ ├── NestedListBuilderTemplate.php.twig │ │ ├── ResultsBuilderTemplate.php.twig │ │ ├── RowBuilderTemplate.php.twig │ │ ├── footer.php.twig │ │ ├── nbresults.php.twig │ │ └── thead.php.twig │ ├── NewAction │ │ ├── NewBuilderAction.php.twig │ │ ├── create.php.twig │ │ └── index.php.twig │ ├── PrintableColumns │ │ ├── boolean.php.twig │ │ ├── collection.php.twig │ │ ├── columns.php.twig │ │ ├── date.php.twig │ │ ├── datetime.php.twig │ │ ├── decimal.php.twig │ │ └── money.php.twig │ ├── ShowAction │ │ ├── ShowBuilderAction.php.twig │ │ └── index.php.twig │ ├── ShowTemplate │ │ ├── ShowBuilderTemplate.php.twig │ │ ├── column.php.twig │ │ ├── show.php.twig │ │ └── sidebar.php.twig │ ├── batch_actions.php.twig │ ├── csrf_protection.php.twig │ ├── generic_actions.php.twig │ ├── javascripts.php.twig │ ├── modals.php.twig │ ├── object_actions.php.twig │ ├── security_action.php.twig │ ├── stylesheets.php.twig │ ├── tabs.php.twig │ └── title.php.twig │ ├── Doctrine │ ├── ActionsBuilderAction.php.twig │ ├── ActionsBuilderTemplate.php.twig │ ├── Edit │ │ └── FormBuilderTemplate.php.twig │ ├── EditBuilderAction.php.twig │ ├── EditBuilderTemplate.php.twig │ ├── EditBuilderType.php.twig │ ├── ExcelBuilderAction.php.twig │ ├── FiltersBuilderType.php.twig │ ├── List │ │ ├── FiltersBuilderTemplate.php.twig │ │ ├── ResultsBuilderTemplate.php.twig │ │ └── RowBuilderTemplate.php.twig │ ├── ListBuilderAction.php.twig │ ├── ListBuilderTemplate.php.twig │ ├── NestedList │ │ ├── ResultsBuilderTemplate.php.twig │ │ └── RowBuilderTemplate.php.twig │ ├── NestedListBuilderAction.php.twig │ ├── NestedListBuilderTemplate.php.twig │ ├── NewBuilderAction.php.twig │ ├── ShowBuilderAction.php.twig │ └── ShowBuilderTemplate.php.twig │ ├── DoctrineODM │ ├── ActionsBuilderAction.php.twig │ ├── ActionsBuilderTemplate.php.twig │ ├── Edit │ │ └── FormBuilderTemplate.php.twig │ ├── EditBuilderAction.php.twig │ ├── EditBuilderTemplate.php.twig │ ├── EditBuilderType.php.twig │ ├── ExcelBuilderAction.php.twig │ ├── FiltersBuilderType.php.twig │ ├── List │ │ ├── ResultsBuilderTemplate.php.twig │ │ └── RowBuilderTemplate.php.twig │ ├── ListBuilderAction.php.twig │ ├── ListBuilderTemplate.php.twig │ ├── NestedList │ │ ├── ResultsBuilderTemplate.php.twig │ │ └── RowBuilderTemplate.php.twig │ ├── NewBuilderAction.php.twig │ ├── ShowBuilderAction.php.twig │ └── ShowBuilderTemplate.php.twig │ ├── EmptyBuilderAction.php.twig │ └── Propel │ ├── ActionsBuilderAction.php.twig │ ├── ActionsBuilderTemplate.php.twig │ ├── Edit │ └── FormBuilderTemplate.php.twig │ ├── EditBuilderAction.php.twig │ ├── EditBuilderTemplate.php.twig │ ├── EditBuilderType.php.twig │ ├── ExcelBuilderAction.php.twig │ ├── FiltersBuilderType.php.twig │ ├── List │ ├── FiltersBuilderTemplate.php.twig │ ├── ResultsBuilderTemplate.php.twig │ └── RowBuilderTemplate.php.twig │ ├── ListBuilderAction.php.twig │ ├── ListBuilderTemplate.php.twig │ ├── NestedList │ ├── ResultsBuilderTemplate.php.twig │ └── RowBuilderTemplate.php.twig │ ├── NestedListBuilderAction.php.twig │ ├── NestedListBuilderTemplate.php.twig │ ├── NewBuilderAction.php.twig │ ├── ShowBuilderAction.php.twig │ └── ShowBuilderTemplate.php.twig ├── Routing ├── NestedRoutingLoader.php └── RoutingLoader.php ├── Tests ├── Builder │ ├── BaseBuilderTest.php │ └── Fixtures │ │ └── BaseBuilder.php.twig ├── ClassLoader │ └── AdmingeneratedClassLoaderTest.php ├── DependencyInjection │ └── ConfigurationTest.php ├── Filesystem │ ├── Fake │ │ └── Empty │ └── RelativePathComputerTest.php ├── Generator │ ├── ActionTest.php │ └── ColumnTest.php ├── Mocks │ └── Doctrine │ │ ├── ConnectionMock.php │ │ ├── DatabasePlatformMock.php │ │ ├── DriverConnectionMock.php │ │ ├── DriverMock.php │ │ ├── EntityManagerMock.php │ │ ├── ExceptionConverterMock.php │ │ ├── ResultMock.php │ │ ├── SchemaManagerMock.php │ │ └── StatementMock.php ├── QueryFilter │ ├── DoctrineQueryFilterTest.php │ └── Entity │ │ ├── Movie.php │ │ ├── MovieRepository.php │ │ └── Producer.php ├── TestCase.php ├── Twig │ ├── Extension │ │ ├── AbstractExtensionTestCase.php │ │ ├── ArrayExtensionTest.php │ │ ├── ConfigExtensionTest.php │ │ ├── EchoExtensionTest.php │ │ └── TestObject.php │ └── Fixtures │ │ └── .gitkeep ├── autoload.php.dist └── bootstrap.php ├── Twig ├── Extension │ ├── ArrayExtension.php │ ├── ClassifyExtension.php │ ├── ConfigExtension.php │ ├── CsrfTokenExtension.php │ ├── EchoExtension.php │ ├── ExtendsAdmingeneratedExtension.php │ ├── LocalizedMoneyExtension.php │ └── SecurityExtension.php └── TokenParser │ └── ExtendsAdmingeneratedTokenParser.php ├── UPGRADE.MD ├── Validator ├── BaseValidator.php ├── ModelClassValidator.php ├── PropelModelClassValidator.php └── ValidatorInterface.php ├── bower.json ├── composer.json └── phpunit.xml.dist /.github/workflows/phpunit.yml: -------------------------------------------------------------------------------- 1 | name: PHPUnit tests 2 | on: 3 | push 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | strategy: 13 | matrix: 14 | php: [ '8.2', '8.3', '8.4' ] 15 | name: On PHP ${{ matrix.php }} 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | 20 | - name: Setup PHP ${{ matrix.php }} 21 | uses: shivammathur/setup-php@v2 22 | with: 23 | php-version: ${{ matrix.php }} 24 | 25 | - name: Install dependencies (latest) 26 | run: composer install --prefer-dist --no-progress 27 | 28 | - name: Run test suite (latest) 29 | run: ./vendor/bin/phpunit 30 | 31 | - name: Install dependencies (lowest) 32 | run: composer update --prefer-lowest --no-progress 33 | 34 | - name: Run test suite (lowest) 35 | run: ./vendor/bin/phpunit 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | composer.lock 2 | composer.phar 3 | vendor/* 4 | 5 | # Eclipse configuration 6 | .buildpath 7 | .project 8 | .settings 9 | 10 | # Ignore idea dirs 11 | .idea 12 | -------------------------------------------------------------------------------- /.php_cs: -------------------------------------------------------------------------------- 1 | notName('LICENSE') 7 | ->notName('*.md') 8 | ->notName('*.twig') 9 | ->notName('.php_cs') 10 | ->notName('composer.*') 11 | ->notName('phpunit.xml*') 12 | ->notName('*.phar') 13 | ->exclude('vendor') 14 | ->in(__DIR__) 15 | ; 16 | 17 | return Symfony\CS\Config\Config::create() 18 | ->finder($finder) 19 | ; 20 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | checks: 2 | php: 3 | code_rating: true 4 | duplication: true 5 | tools: 6 | # use travis code coverage report 7 | external_code_coverage: 8 | timeout: 3600 9 | runs: 1 10 | # php cs fixer 11 | php_cs_fixer: 12 | config: { level: all } 13 | # sensiolabs security checker 14 | sensiolabs_security_checker: true 15 | # php code sniffer 16 | php_code_sniffer: 17 | config: 18 | standard: "PSR2" 19 | -------------------------------------------------------------------------------- /AdmingeneratorGeneratorBundle.php: -------------------------------------------------------------------------------- 1 | addCompilerPass(new ValidatorPass()); 20 | $container->addCompilerPass(new FormPass()); 21 | $container->addCompilerPass(new TwigLoaderPass()); 22 | $container->addCompilerPass(new RemoveMakerCommandPass()); 23 | } 24 | 25 | public function getContainerExtension(): AdmingeneratorGeneratorExtension 26 | { 27 | $this->extension = new AdmingeneratorGeneratorExtension(); 28 | 29 | return $this->extension; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Builder/Admin/ActionsBuilderAction.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class ActionsBuilderAction extends ActionsBuilder 10 | { 11 | public function getOutputName(): string 12 | { 13 | return $this->getGenerator()->getGeneratedControllerFolder().'/ActionsController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | class ActionsBuilderTemplate extends ActionsBuilder 10 | { 11 | public function getOutputName(): string 12 | { 13 | return 'Resources/views/'.$this->getBaseGeneratorName().'Actions/index.html.twig'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilder.php: -------------------------------------------------------------------------------- 1 | 10 | * @author Stéphane Escandell 11 | */ 12 | class EditBuilder extends BaseBuilder 13 | { 14 | public function getYamlKey(): string 15 | { 16 | return 'edit'; 17 | } 18 | 19 | /** 20 | * Retrieve the FQCN formType used by this builder 21 | */ 22 | public function getFormType(): string 23 | { 24 | return sprintf( 25 | '%s%s\\Form\Type\\%s\\EditType', 26 | $this->getVariable('namespace_prefix') ? $this->getVariable('namespace_prefix') . '\\' : '', 27 | $this->getVariable('bundle_name'), 28 | $this->getBaseGeneratorName() 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/EditController.php'; 14 | } 15 | 16 | /** 17 | * Return a list of action from list.object_actions 18 | */ 19 | public function getObjectActions(): array 20 | { 21 | $objectActions = parent::getObjectActions(); 22 | 23 | if (array_key_exists('edit', $objectActions)) { 24 | unset($objectActions['edit']); 25 | $this->objectActions = $objectActions; 26 | } 27 | 28 | return $this->objectActions; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 'Resources/views/'.$this->getBaseGeneratorName().'Edit/index.html.twig', 16 | 'Edit/FormBuilderTemplate'.self::TWIG_EXTENSION 17 | => 'Resources/views/'.$this->getBaseGeneratorName().'Edit/form.html.twig', 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Builder/Admin/EditBuilderType.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Type/EditType.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/EmptyBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ExcelController.php'; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Builder/Admin/FiltersBuilderType.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Type/FiltersType.php'; 14 | } 15 | 16 | public function getTemplateName(): string 17 | { 18 | if ($this->environment === null) { 19 | return $this->getGenerator()->getTemplateBaseDir() . parent::getTemplateName(); 20 | } 21 | return '@AdmingeneratorGenerator/templates/' . $this->getGenerator()->getTemplateBaseDir() . 'FiltersBuilderType' . self::TWIG_EXTENSION; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Builder/Admin/ListBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ListController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/NestedListBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ListController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/NestedListBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 'Resources/views/'.$this->getBaseGeneratorName().'List/index.html.twig', 16 | 'NestedList/ResultsBuilderTemplate'.self::TWIG_EXTENSION 17 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/results.html.twig', 18 | 'NestedList/RowBuilderTemplate'.self::TWIG_EXTENSION 19 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/row.html.twig', 20 | 'List/FiltersBuilderTemplate'.self::TWIG_EXTENSION 21 | => 'Resources/views/'.$this->getBaseGeneratorName().'List/filters.html.twig', 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilder.php: -------------------------------------------------------------------------------- 1 | 10 | * @author Stéphane Escandell 11 | */ 12 | class NewBuilder extends BaseBuilder 13 | { 14 | public function getYamlKey(): string 15 | { 16 | return 'new'; 17 | } 18 | 19 | public function getFormType(): string 20 | { 21 | return sprintf( 22 | '%s%s\\Form\Type\\%s\\NewType', 23 | $this->getVariable('namespace_prefix') ? $this->getVariable('namespace_prefix') . '\\' : '', 24 | $this->getVariable('bundle_name'), 25 | $this->getBaseGeneratorName() 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/NewController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 'Resources/views/'.$this->getBaseGeneratorName().'New/index.html.twig', 20 | 'Edit/FormBuilderTemplate'.self::TWIG_EXTENSION 21 | => 'Resources/views/'.$this->getBaseGeneratorName().'New/form.html.twig', 22 | ]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Builder/Admin/NewBuilderType.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Type/NewType.php'; 14 | } 15 | 16 | public function getTemplateName(): string 17 | { 18 | if ($this->environment === null) { 19 | return $this->getGenerator()->getTemplateBaseDir() . parent::getTemplateName(); 20 | } 21 | return '@AdmingeneratorGenerator/templates/' . $this->getGenerator()->getTemplateBaseDir() . 'EditBuilderType' . self::TWIG_EXTENSION; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Builder/Admin/ShowBuilder.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ShowBuilder extends BaseBuilder 12 | { 13 | public function getYamlKey(): string 14 | { 15 | return 'show'; 16 | } 17 | 18 | public function getObjectActions(): array 19 | { 20 | $objectActions = parent::getObjectActions(); 21 | 22 | if (array_key_exists('show', $objectActions)) { 23 | unset($objectActions['show']); 24 | $this->objectActions = $objectActions; 25 | } 26 | 27 | return $this->objectActions; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Builder/Admin/ShowBuilderAction.php: -------------------------------------------------------------------------------- 1 | getGenerator()->getGeneratedControllerFolder().'/ShowController.php'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Admin/ShowBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | getBaseGeneratorName().'Show/index.html.twig'; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Builder/Doctrine/ActionsBuilderAction.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderAction extends AdminActionsBuilderAction 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Doctrine/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderTemplate extends AdminActionsBuilderTemplate 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Doctrine/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderAction extends AdminActionsBuilderAction 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/DoctrineODM/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderTemplate extends AdminActionsBuilderTemplate 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/DoctrineODM/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | tempDir = $baseTempDir.DIRECTORY_SEPARATOR.self::TEMP_DIR_PREFIX; 24 | 25 | if (!is_dir($this->tempDir)) { 26 | mkdir($this->tempDir, 0777, true); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Builder/Propel/ActionsBuilderAction.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderAction extends AdminActionsBuilderAction 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Propel/ActionsBuilderTemplate.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ActionsBuilderTemplate extends AdminActionsBuilderTemplate 12 | { 13 | } 14 | -------------------------------------------------------------------------------- /Builder/Propel/EditBuilderAction.php: -------------------------------------------------------------------------------- 1 | generatorCacheBuilder->buildFull(); 25 | 26 | return []; 27 | } 28 | 29 | public function isOptional(): bool 30 | { 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Controller/Doctrine/BaseController.php: -------------------------------------------------------------------------------- 1 | container->has('odm_manager')) { 20 | throw new \LogicException('The DoctrineMongoDBBundle is not registered in your application.'); 21 | } 22 | 23 | return $this->container->get('odm_manager'); 24 | } 25 | 26 | protected function getDocumentManager(): \Doctrine\ODM\MongoDB\DocumentManager 27 | { 28 | if (!$this->container->has('odm_document_manager')) { 29 | throw new \LogicException('The DoctrineMongoDBBundle is not registered in your application.'); 30 | } 31 | 32 | return $this->container->get('odm_document_manager'); 33 | } 34 | 35 | public static function getSubscribedServices(): array 36 | { 37 | return array_merge( 38 | parent::getSubscribedServices(), 39 | [ 40 | 'odm_manager' => '?'.\Doctrine\Bundle\MongoDBBundle\ManagerRegistry::class, 41 | 'odm_document_manager' => '?'.\Doctrine\ODM\MongoDB\DocumentManager::class 42 | ] 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Controller/Propel/BaseController.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class FormPass implements CompilerPassInterface 14 | { 15 | public function process(ContainerBuilder $container): void 16 | { 17 | $this->injectFormThemeConfiguration($container); 18 | } 19 | 20 | /** 21 | * Check if we need to automatically add form theme from admingen in the 22 | * application configuration. 23 | */ 24 | private function injectFormThemeConfiguration(ContainerBuilder $container): void 25 | { 26 | if (($twigConfiguration = $container->getParameter('admingenerator.twig')) !== false) { 27 | $resources = $container->getParameter('twig.form.resources'); 28 | $alreadyIn = in_array('bootstrap_3_layout.html.twig', $resources); 29 | 30 | if ($twigConfiguration['use_form_resources'] && !$alreadyIn) { 31 | $key = array_search('form_div_layout.html.twig', $resources) ?: 0; 32 | // Insert right after form_div_layout.html.twig if exists 33 | array_splice($resources, ++$key, 0, ['bootstrap_3_layout.html.twig']); 34 | 35 | $container->setParameter('twig.form.resources', $resources); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DependencyInjection/Compiler/RemoveMakerCommandPass.php: -------------------------------------------------------------------------------- 1 | hasDefinition('maker.generator')) { 14 | return; 15 | } 16 | 17 | // Remove maker command when the maker bundle has not been installed 18 | $container->removeDefinition('admingenerator.maker.make_admin'); 19 | } 20 | } -------------------------------------------------------------------------------- /DependencyInjection/Compiler/TwigLoaderPass.php: -------------------------------------------------------------------------------- 1 | hasParameter('admingenerator.generate_base_in_project_dir_directory') 13 | ? $container->getParameter('admingenerator.generate_base_in_project_dir_directory') 14 | : $container->getParameter('kernel.cache_dir'); 15 | 16 | if ($container->hasDefinition('twig.loader.filesystem')) { 17 | $container 18 | ->getDefinition('twig.loader.filesystem') 19 | ->addMethodCall('addPath', [$templateDir]); 20 | } 21 | 22 | if ($container->hasDefinition('twig.loader.native_filesystem')) { 23 | $container 24 | ->getDefinition('twig.loader.native_filesystem') 25 | ->addMethodCall('addPath', [$templateDir]); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Exception/CantGenerateException.php: -------------------------------------------------------------------------------- 1 | errors; 21 | } 22 | 23 | /** 24 | * Validate and set errors. 25 | * 26 | * @param ConstraintViolation[] $errors An array of ConstraintViolation instances. 27 | */ 28 | public function setErrors(array $errors = []): void 29 | { 30 | foreach ($errors as $error) { 31 | if (!$error instanceof ConstraintViolation) { 32 | throw new \InvalidArgumentException(sprintf('The supplied error is of class "%s", while a "Symfony\Component\Validator\ConstraintViolation" was expected.', get_class($error))); 33 | } 34 | } 35 | 36 | $this->errors = $errors; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Filesystem/RelativePathComputer.php: -------------------------------------------------------------------------------- 1 | referencePath = realpath($path); 21 | } 22 | 23 | /** 24 | * Retrieve relative path from reference to $dir 25 | */ 26 | public function computeToParent(string $dir): string 27 | { 28 | if (!$this->isParent($dir)) { 29 | throw new LogicException('Targeted dir must be a parent to the reference path.'); 30 | } 31 | 32 | $pathToReference = substr($this->referencePath, strlen($dir)); 33 | $pathToReference = strtr($pathToReference, DIRECTORY_SEPARATOR, '/'); 34 | $subdirs = explode('/', $pathToReference); 35 | 36 | return str_repeat('..' . DIRECTORY_SEPARATOR, count($subdirs)-1); 37 | } 38 | 39 | /** 40 | * Check if $dir is a parent to the referenced directory 41 | */ 42 | public function isParent(string $dir): bool 43 | { 44 | return str_starts_with($this->referencePath, realpath($dir)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Generator/Action/Batch/DeleteAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class DeleteAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'batch'); 18 | 19 | $this->setIcon('fa-times'); 20 | $this->setLabel('action.batch.delete.label'); 21 | $this->setConfirm('action.batch.delete.confirm'); 22 | $this->setCsrfProtected(true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Generator/Action/Generic/ExcelAction.php: -------------------------------------------------------------------------------- 1 | 12 | * @author Bob van de Vijver 13 | */ 14 | class ExcelAction extends Action 15 | { 16 | public function __construct($name, BaseBuilder $builder) 17 | { 18 | parent::__construct($name, 'generic'); 19 | 20 | $this->setClass('btn-info'); 21 | $this->setIcon('fa-regular fa-file-excel'); 22 | $this->setLabel('action.generic.excel'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Generator/Action/Generic/ListAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class ListAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'generic'); 18 | 19 | $this->setIcon('fa-rectangle-list fa-regular'); 20 | $this->setLabel('action.generic.list'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Generator/Action/Generic/NewAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class NewAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'generic'); 18 | 19 | $this->setClass('btn-primary'); 20 | $this->setIcon('fa-plus'); 21 | $this->setLabel('action.generic.new'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Generic/SaveAction.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class SaveAction extends Action 13 | { 14 | public function __construct($name, BaseBuilder $builder) 15 | { 16 | parent::__construct($name, 'generic'); 17 | 18 | $this->setSubmit(true); 19 | $this->setClass('btn-success'); 20 | $this->setIcon('fa-check'); 21 | $this->setLabel('action.generic.save'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Generic/SaveAndAddAction.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class SaveAndAddAction extends Action 13 | { 14 | public function __construct($name, BaseBuilder $builder) 15 | { 16 | parent::__construct($name, 'generic'); 17 | 18 | $this->setSubmit(true); 19 | $this->setClass('btn-primary'); 20 | $this->setIcon('fa-check'); 21 | $this->setLabel('action.generic.save-and-add'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Generic/SaveAndListAction.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class SaveAndListAction extends Action 13 | { 14 | public function __construct($name, BaseBuilder $builder) 15 | { 16 | parent::__construct($name, 'generic'); 17 | 18 | $this->setSubmit(true); 19 | $this->setClass('btn-info'); 20 | $this->setIcon('fa-check'); 21 | $this->setLabel('action.generic.save-and-list'); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Generator/Action/Generic/SaveAndShowAction.php: -------------------------------------------------------------------------------- 1 | 11 | * @author Bob van de Vijver 12 | */ 13 | class SaveAndShowAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'generic'); 18 | 19 | $this->setSubmit(true); 20 | $this->setClass('btn-info'); 21 | $this->setIcon('fa-check'); 22 | $this->setLabel('action.generic.save-and-show'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Generator/Action/Object/DeleteAction.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | class DeleteAction extends Action 15 | { 16 | public function __construct($name, BaseBuilder $builder) 17 | { 18 | parent::__construct($name, 'object'); 19 | 20 | $this->setIcon('fa-times'); 21 | $this->setLabel('action.object.delete.label'); 22 | $this->setConfirm('action.object.delete.confirm'); 23 | $this->setCsrfProtected(true); 24 | 25 | $this->setRoute($builder->getObjectActionsRoute()); 26 | 27 | $this->setParams([ 28 | 'pk' => '{{ '.$builder->getModelClass().'.'.$builder->getModelPrimaryKeyName().' }}', 29 | 'action' => 'delete' 30 | ]); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Generator/Action/Object/EditAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class EditAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'object'); 18 | 19 | $this->setIcon('fa-pen-to-square fa-regular'); 20 | $this->setLabel('action.object.edit.label'); 21 | 22 | $this->setRoute($builder->getBaseActionsRoute().'_edit'); 23 | 24 | $this->setParams(array( 25 | 'pk' => '{{ '.$builder->getModelClass().'.'.$builder->getModelPrimaryKeyName().' }}', 26 | )); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Generator/Action/Object/ShowAction.php: -------------------------------------------------------------------------------- 1 | 12 | */ 13 | class ShowAction extends Action 14 | { 15 | public function __construct($name, BaseBuilder $builder) 16 | { 17 | parent::__construct($name, 'object'); 18 | 19 | $this->setIcon('fa-eye fa-regular'); 20 | $this->setLabel('action.object.show.label'); 21 | 22 | $this->setRoute($builder->getBaseActionsRoute().'_show'); 23 | 24 | $this->setParams(array( 25 | 'pk' => '{{ '.$builder->getModelClass().'.'.$builder->getModelPrimaryKeyName().' }}', 26 | )); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Generator/GeneratorInterface.php: -------------------------------------------------------------------------------- 1 | sortOn != "" ? $this->sortOn : InflectorFactory::create()->build()->classify($this->name); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Guesser/DoctrineODMFieldGuesser.php: -------------------------------------------------------------------------------- 1 | factory->createItem('root'); 10 | $menu->setChildrenAttributes(array('class' => 'sidebar-menu')); 11 | 12 | if ($dashboardRoute = $this->dashboardRoute) { 13 | $this 14 | ->addLinkRoute($menu, 'admingenerator.dashboard', $dashboardRoute) 15 | ->setExtra('icon', 'fa fa-gauge'); 16 | } 17 | 18 | $overwrite = $this->addDropdown($menu, 'Replace this menu'); 19 | 20 | $this->addLinkURI( 21 | $overwrite, 22 | 'Create new menu builder', 23 | 'https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle' 24 | .'/blob/master/Resources/doc/cookbook/menu.md' 25 | )->setExtra('icon', 'fa fa-wrench'); 26 | 27 | $this->addLinkURI( 28 | $overwrite, 29 | 'Customize menu block', 30 | 'https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle'. 31 | '/blob/master/Resources/views/base_admin_navbar.html.twig' 32 | )->setExtra('icon', 'fa fa-code-fork'); 33 | 34 | return $menu; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /QueryFilter/BaseQueryFilter.php: -------------------------------------------------------------------------------- 1 | query; 19 | } 20 | 21 | public function addDefaultFilter(string $field, string $value): void 22 | { 23 | throw new LogicException('No method defined to execute this type of filters'); 24 | } 25 | 26 | /** 27 | * By default we call addDefaultFilter 28 | */ 29 | public function __call(string $name, array $values = []) 30 | { 31 | if (preg_match('/add(.+)Filter/', $name)) { 32 | $this->addDefaultFilter($values[0], $values[1]); 33 | } 34 | } 35 | 36 | protected function formatDate(mixed $date, string $format): string|false 37 | { 38 | if ($date === null || $date === false) { 39 | return false; 40 | } 41 | 42 | return $date instanceof DateTimeInterface ? $date->format($format) : (new DateTime($date))->format($format); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /QueryFilter/QueryFilterInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Admingenerator\GeneratorBundle\Generator\DoctrineGenerator 8 | Admingenerator\GeneratorBundle\Guesser\DoctrineORMFieldGuesser 9 | Admingenerator\GeneratorBundle\QueryFilter\DoctrineQueryFilter 10 | 11 | 12 | 13 | 14 | 16 | 17 | entity 18 | 19 | 20 | 23 | %kernel.cache_dir% 24 | 25 | parameter('admingenerator') 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Resources/config/propel.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | Admingenerator\GeneratorBundle\Generator\PropelGenerator 8 | Admingenerator\GeneratorBundle\Guesser\PropelORMFieldGuesser 9 | Admingenerator\GeneratorBundle\QueryFilter\PropelQueryFilter 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 20 | %kernel.cache_dir% 21 | 22 | parameter('admingenerator') 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Resources/doc/admin/builder-show.md: -------------------------------------------------------------------------------- 1 | # Show builder configuration 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | The show builder is the simplest builder of this bundle: it simply creates a page where the values of your object are 8 | displayed. 9 | 10 | The show builder takes only a few parameters: 11 | 12 | ```yaml 13 | builders: 14 | show: 15 | title: ~ 16 | display: ~ 17 | actions: ~ 18 | ``` 19 | 20 | #### Title 21 | 22 | `title` __default__: `{basekey}.title` __type__: `string` 23 | 24 | Used to set the title of the page. By default, it is filled with `{admingeneratorprefix}.title`. 25 | 26 | #### Display 27 | 28 | `display` __default__: `~` __type__: `array` 29 | 30 | See the [edit/new documentation][edit-doc-display]. 31 | 32 | #### Actions 33 | 34 | `actions` __default__: `~` __type__: `array` 35 | 36 | Actions can be enabled by simply specifying them here with the value `~`. The following example will render the save and 37 | list action below the form: 38 | 39 | ```yaml 40 | edit: 41 | params: 42 | actions: 43 | list: ~ 44 | new: ~ 45 | ``` 46 | 47 | You can also use self-defined actions from your global generator parameters, or overwrite specific part of the actions. 48 | Check the [action documentation][action-doc] for more information. 49 | 50 | 51 | [back-to-index]: ../documentation.md 52 | [action-doc]: actions.md 53 | [edit-doc-display]: builder-edit.md#display -------------------------------------------------------------------------------- /Resources/doc/admin/builders.md: -------------------------------------------------------------------------------- 1 | # Builder configuration 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | ### Edit/new builder 8 | 9 | The edit/new builder is used to configure the form which is displayed when creating or editing an object. 10 | 11 | The edit builder and the new builder can be considered the same: they both deliver a form, with the difference that one 12 | is already filled with data from your database. However, the configuration is splitted, allowing you to customize them 13 | separately. 14 | 15 | You can read more about the edit/new builder in [it's own documentation page][edit-builder]. 16 | 17 | ### List builder 18 | 19 | The list builder is used to configure the list view. You can read more about the list builder in 20 | [it's own documentation page][list-builder]. 21 | 22 | ### Filters builder 23 | 24 | The filters builder is used to configure the filters which are displayed on the list view. You can read more about the 25 | filter builder in [it's own documentation page][filter-builder]. 26 | 27 | ### Excel builder 28 | 29 | The excel builder is used to configure the Excel export of the current list. Keep in mind that the filters currently 30 | applied to the list, are also applied to the export. 31 | 32 | You can read more about the excel builder in [it's own documentation page][excel-builder]. 33 | 34 | ### Show builder 35 | 36 | The show builder is used to configure the show view. You can read more about the show builder in 37 | [it's own documentation page][show-builder]. 38 | 39 | 40 | [back-to-index]: ../documentation.md 41 | [edit-builder]: builder-edit.md 42 | [excel-builder]: builder-excel.md 43 | [list-builder]: builder-list.md 44 | [filter-builder]: builder-filter.md 45 | [show-builder]: builder-show.md 46 | -------------------------------------------------------------------------------- /Resources/doc/admin/images/list-filters-collapsed-top-position-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/admin/images/list-filters-collapsed-top-position-preview.png -------------------------------------------------------------------------------- /Resources/doc/admin/images/list-filters-default-position-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/admin/images/list-filters-default-position-preview.png -------------------------------------------------------------------------------- /Resources/doc/admin/images/list-filters-modal-large-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/admin/images/list-filters-modal-large-preview.png -------------------------------------------------------------------------------- /Resources/doc/admin/images/list-filters-modal-list-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/admin/images/list-filters-modal-list-preview.png -------------------------------------------------------------------------------- /Resources/doc/admin/images/list-filters-modal-medium-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/admin/images/list-filters-modal-medium-preview.png -------------------------------------------------------------------------------- /Resources/doc/admin/images/list-filters-modal-small-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/admin/images/list-filters-modal-small-preview.png -------------------------------------------------------------------------------- /Resources/doc/admin/images/list-filters-top-position-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/admin/images/list-filters-top-position-preview.png -------------------------------------------------------------------------------- /Resources/doc/cookbook/custom-avatars.md: -------------------------------------------------------------------------------- 1 | # Custom Avatars 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | 8 | To customize the avatars simply create directories: 9 | 10 | * `app/Resources/AdmingeneratorGeneratorBundle/views/Navbar` 11 | * `app/Resources/AdmingeneratorGeneratorBundle/views/Sidebar` 12 | 13 | And create `avatar_source.html.twig` files in each directory. 14 | 15 | Customize the template to render an URL to the correct image. Example implementation with `FormExtensionsBundle` configured to work with `VichUploaderBundle` and `LiipImagineBundle`: 16 | 17 | ```html+django 18 | {# avatar_source.html.twig #} 19 | {{ image_asset(app.user, 'avatar')|image_filter('avatar') }} 20 | ``` 21 | 22 | Once you're done, you **MUST** clear your cache (even in DEV mode) with `php bin/console cache:clear -e=prod` (or dev). 23 | 24 | [back-to-index]: ../documentation.md -------------------------------------------------------------------------------- /Resources/doc/cookbook/images/a2lix-integrations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/cookbook/images/a2lix-integrations.png -------------------------------------------------------------------------------- /Resources/doc/cookbook/images/breadcrumbs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/cookbook/images/breadcrumbs.png -------------------------------------------------------------------------------- /Resources/doc/cookbook/images/console-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/cookbook/images/console-example.png -------------------------------------------------------------------------------- /Resources/doc/cookbook/images/modal-with-field.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/cookbook/images/modal-with-field.jpg -------------------------------------------------------------------------------- /Resources/doc/cookbook/modal-with-fields.md: -------------------------------------------------------------------------------- 1 | # Modals with additional fields 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | Sometimes, you may need to add a field to modal dialog. 8 | You can simply do it by adding modal with the field: 9 | 10 | ```twig 11 | {% extends_admingenerated "AdmingeneratorDoctrineOrmDemoBundle:PostList:index.html.twig" %} 12 | 13 | {% block modals %} 14 | {{ parent() }} 15 | 37 | {% endblock %} 38 | ``` 39 | 40 | In your `YourBundleNameBundle/Resources/config/yourPrefix-generator.yml` 41 | 42 | ```yaml 43 | params: 44 | object_actions: 45 | postpone: 46 | confirm: Do you really want to postpone? 47 | confirmModal: confirmObjectModalPostpone 48 | ``` 49 | 50 | Now you will have the postpone date in POST parameter 51 | 52 | ```php 53 | $request->request->get('postpone') 54 | ``` 55 | 56 | Result 57 | 58 | ![modal with field](images/modal-with-field.jpg) 59 | 60 | [back-to-index]: ../documentation.md -------------------------------------------------------------------------------- /Resources/doc/cookbook/multiple-entity-managers.md: -------------------------------------------------------------------------------- 1 | # Usage of different Doctrine Entity Managers 2 | 3 | [Go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | ### 1. Usage 8 | 9 | When using Doctrine, all managers are auto-selected by the use of `getManagerForClass` method of Doctrine. 10 | 11 | ### 2. Support 12 | 13 | Multiple Object Managers are only automatically implemented for **Doctrine (ORM and ODM)**. 14 | 15 | [back-to-index]: ../documentation.md -------------------------------------------------------------------------------- /Resources/doc/cookbook/view-parameters.md: -------------------------------------------------------------------------------- 1 | # Adding parameters in the view from the controller 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | Sometimes, you may need to transmit some parameters from your *generated* controller to your *generated* view. 8 | You can simply do it by overriding the protected **getAdditionalRenderParameters** function into your bundle. Depending on controller *type*, prototype is different: 9 | 10 | In the *list* controllers (`ListController` and `NestedListController`) the prototype is: 11 | ```php 12 | protected function getAdditionalRenderParameters(); // No parameters 13 | ``` 14 | 15 | In the *edit*, *show* and *new* controllers (`EditController`, `ShowController` and `NewController`) the prototype is: 16 | ```php 17 | protected function getAdditionalRenderParameters(\Full\Path\To\Your\Object $Object); 18 | ``` 19 | 20 | This function **must** return an array. By default, it returns an empty array. 21 | 22 | > **Note:** this function is not available in `DeleteController` because it always returns a `RedirectResponse`. 23 | 24 | [back-to-index]: ../documentation.md -------------------------------------------------------------------------------- /Resources/doc/customization/templates.md: -------------------------------------------------------------------------------- 1 | # Template customization 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | Sometimes, you may want to extend/overwrite some of the generator templates in the Resources/templates dir. 8 | This is quite easy, but you will have to do some steps. 9 | 10 | 1. First, you will need to add the template you will be using to the admingenerator config 11 | ```yaml 12 | # config.yml 13 | admingenerator_generator: 14 | templates_dirs: [ "%kernel.project_dir%/app/Resources/AdmingeneratorGeneratorBundle/templates" ] 15 | ``` 16 | 17 | 2. Keep in mind that you will at least need **one dir** in the previous specified template directory, namely of the 18 | DBAL layer used, so one of [Doctrine, DoctrineODM, Propel]. 19 | Without this directory, the specified template directory will not be used for extending/overwriting any of the 20 | templates, even in the CommonAdmin dir. 21 | 22 | 3. Be free to extend/overwrite any template in the Resources/templates dir of the AdminGenerator! 23 | 24 | Please note that your own templates might need adjustment when new releases of the AdminGenerator arrive. So if anything 25 | breaks after an update and you're using custom templates, please check those first! 26 | 27 | 28 | [back-to-index]: ../documentation.md 29 | -------------------------------------------------------------------------------- /Resources/doc/getting-started/create-admin.md: -------------------------------------------------------------------------------- 1 | # Create an admin generator 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | To create an admin, simply execute the following command: 8 | ``` 9 | php app/console admin:generate-admin 10 | ``` 11 | 12 | It will ask a few simple questions to be able to configure the new admin correctly. Below are the questions with possible answers, we use the Acme/AdminBundle with an Article model: 13 | 1. __Fully qualified bundle name__: Acme/AdminBundle 14 | * Use this field to indicate the target bundle. Make sure the name ends on Bundle and that you use a forward slash for the namespace. If the bundle does not exist, it will be created. 15 | 2. __Target directory__: (use default) 16 | * If you have another location to generate/look for the new bundle, give it now. 17 | 3. __Generator__: doctrine/doctrine_odm/propel 18 | * Choose the correct model manager for your model. 19 | 4. __Model name__: Article 20 | * The complete name of the model you want to manage. Note that you want to give the fully qualified name if the model is not located in the same bundle. 21 | 5. __Prefix of yaml__: AdminArticle 22 | * This text will be added as prefix to the generator config file for easy recognition. 23 | 24 | 25 | #### Command options 26 | If you do not want to use the step-by-step command, you can also directly use the parameters. 27 | 28 | ``` 29 | --namespace=NAMESPACE The namespace of the admin to create 30 | --dir=DIR The directory where to create the admin 31 | --generator=GENERATOR The generator service (propel, doctrine, doctrine_odm) [default: "doctrine"] 32 | --model-name=MODEL-NAME Base model name for admin module, without namespace. [default: "YourModel"] 33 | --prefix=PREFIX The generator prefix ([prefix]-generator.yml) 34 | ``` 35 | 36 | [back-to-index]: ../documentation.md -------------------------------------------------------------------------------- /Resources/doc/img/branching-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/branching-model.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/dashboard-adminlte-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/dashboard-adminlte-preview.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/edit-form.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/edit-form.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/edit-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/edit-preview.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/list-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/list-preview.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/list-with-filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/list-with-filter.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/list-with-scopes--scoped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/list-with-scopes--scoped.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/list-with-scopes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/list-with-scopes.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/list.png -------------------------------------------------------------------------------- /Resources/doc/img/showcase/nestedlist-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/doc/img/showcase/nestedlist-preview.png -------------------------------------------------------------------------------- /Resources/doc/install/form_types/overview.md: -------------------------------------------------------------------------------- 1 | # Form types 2 | 3 | [Go back to Table of contents][back-to-index] 4 | [Go back to General configuration][back-to-general-config] 5 | 6 | The admingenerator guesses the field type based on the attribute type. Please select your model manager to view the default guesses: 7 | * [Doctrine ORM][orm-types] 8 | * [Doctrine ODM][odm-types] 9 | * [Propel][propel-types] 10 | 11 | 12 | [back-to-index]: ../../documentation.md 13 | [back-to-general-config]: ../general-configuration.md 14 | [orm-types]: doctrine_orm.md 15 | [odm-types]: doctrine_odm.md 16 | [propel-types]: propel.md -------------------------------------------------------------------------------- /Resources/doc/support-and-contribution/submitting-issues.md: -------------------------------------------------------------------------------- 1 | # Submitting issues 2 | 3 | [go back to Table of contents][back-to-index] 4 | 5 | ----- 6 | 7 | ### Step 1: Check existing issues 8 | 9 | Go to [our issues page][docs-issues] and search existing issues, your problem may have been answered there already. 10 | 11 | 12 | ### Step 2: Check google groups 13 | 14 | Go to [our google group][docs-google] and search existing threads, your problem may have been answered there already. 15 | 16 | 17 | ### Step 3: Ask on Gitter 18 | 19 | You can always ask for support in our [Gitter][docs-gitter]. You are free to ask questions, however keep in mind that 20 | there is not always someone who can answer them. 21 | 22 | 23 | ### Step 4: Create new issue 24 | 25 | You can create an issue using [Github][docs-issues], using [Github Flavored Markdown][docs-markdown] are much more 26 | human-readable. To create a new issue go to [Github issues][docs-issues] and click on the **New issue** button 27 | (or use [this shortcut][docs-new-issue]). 28 | 29 | 30 | ##### Basic formatting guide 31 | 32 | While writing your issue please use Github Flavored Markdown to make it more readable. If you paste any code **wrap it 33 | in github's code block!** To do that start with 3 **```** characters, then name language you're useing, for example 34 | **yaml**: 35 | 36 | > **```yaml** 37 | > 38 | > my.yaml_code: is here 39 | > 40 | > **```** 41 | 42 | which will resuilt in 43 | ```yaml 44 | my.yaml_code: is here 45 | ``` 46 | 47 | To learn how to use Github Flavoured Markdown simply click on the *Github Flavored Markdown* link above the text field 48 | to see! 49 | 50 | [back-to-index]: ../documentation.md 51 | [docs-gitter]: https://gitter.im/symfony2admingenerator/GeneratorBundle 52 | [docs-google]: http://groups.google.com/group/symfony2admingenerator/topics 53 | [docs-issues]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues 54 | [docs-markdown]: http://github.github.com/github-flavored-markdown 55 | [docs-new-issue]: https://github.com/symfony2admingenerator/AdmingeneratorGeneratorBundle/issues/new 56 | -------------------------------------------------------------------------------- /Resources/public/ico/admingenerator_gravatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/ico/admingenerator_gravatar.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-114-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/ico/apple-touch-icon-114-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-144-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/ico/apple-touch-icon-144-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-57-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/ico/apple-touch-icon-57-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/apple-touch-icon-72-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/ico/apple-touch-icon-72-precomposed.png -------------------------------------------------------------------------------- /Resources/public/ico/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/ico/favicon.ico -------------------------------------------------------------------------------- /Resources/public/img/unauthenticated.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/img/unauthenticated.gif -------------------------------------------------------------------------------- /Resources/public/img/unauthenticated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/public/img/unauthenticated.png -------------------------------------------------------------------------------- /Resources/skeleton/config/yml_generator.tpl.php: -------------------------------------------------------------------------------- 1 | generator: 2 | params: 3 | model: \\ 4 | namespace_prefix: 5 | concurrency_lock: ~ 6 | credentials: ~ 7 | bundle_name: 8 | pk_requirement: ~ 9 | fields: ~ 10 | object_actions: 11 | delete: ~ 12 | batch_actions: 13 | delete: ~ 14 | builders: 15 | list: 16 | params: 17 | title: List for 18 | display: ~ 19 | filters: ~ 20 | filtersMode: ~ 21 | sort: ~ 22 | max_per_page: ~ 23 | fields: ~ 24 | actions: 25 | new: ~ 26 | object_actions: 27 | edit: ~ 28 | delete: ~ 29 | excel: 30 | params: ~ 31 | filename: ~ 32 | filetype: ~ 33 | new: 34 | params: 35 | title: New object for 36 | display: ~ 37 | actions: 38 | save: ~ 39 | list: ~ 40 | edit: 41 | params: 42 | title: "You're editing the object \"%object%\"|{ %object%: .title }|" 43 | display: ~ 44 | actions: 45 | save: ~ 46 | list: ~ 47 | show: 48 | params: 49 | title: "You're viewing the object \"%object%\"|{ %object%: .title }|" 50 | display: ~ 51 | actions: 52 | list: ~ 53 | new: ~ 54 | actions: 55 | params: 56 | object_actions: 57 | delete: ~ 58 | batch_actions: 59 | delete: ~ -------------------------------------------------------------------------------- /Resources/skeleton/controller/controller_generator.tpl.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | namespace \Controller; 4 | 5 | use Admingenerated\\BaseController\Controller as BaseController; 6 | 7 | /** 8 | * Controller 9 | */ 10 | class Controller extends BaseController 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /Resources/skeleton/form/options_generator.tpl.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | namespace \Form\Type; 4 | 5 | /** 6 | * Options class 7 | */ 8 | class Options 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /Resources/skeleton/form/type_generator.tpl.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | namespace \Form\Type; 4 | 5 | use Admingenerated\\Form\BaseType\Type as BaseType; 6 | 7 | /** 8 | * Type 9 | */ 10 | class Type extends BaseType 11 | { 12 | } 13 | -------------------------------------------------------------------------------- /Resources/skeleton/template/twig_generator.tpl.php: -------------------------------------------------------------------------------- 1 | {% extends_admingenerated "::.html.twig" %} 2 | -------------------------------------------------------------------------------- /Resources/views/KnpMenu/knp_menu_trans.html.twig: -------------------------------------------------------------------------------- 1 | {% extends 'knp_menu.html.twig' %} 2 | 3 | {% block label %} 4 | {% if item.getExtra('icon') is defined and item.getExtra('icon') is not empty %}{% endif %} 5 | {% set labelText = item.label|trans(item.getExtra('translation_params', {}), item.getExtra('translation_domain', 'messages')) %} 6 | {% if options.allow_safe_labels and item.getExtra('safe_label', false) %}{{ labelText|raw }}{% else %}{{ labelText }}{% endif %} 7 | {% if item.getExtra('caret') %}{% endif %} 8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /Resources/views/Navbar/authenticated.html.twig: -------------------------------------------------------------------------------- 1 | {% block navbar_profile_authenticated_user_header%} 2 |
  • 3 | {% block navbar_profile_authenticated_user_header_inner %} 4 | Authenticated user 5 |

    6 | {{ app.user }} 7 |

    8 | {% endblock navbar_profile_authenticated_user_header_inner %} 9 |
  • 10 | {% endblock navbar_profile_authenticated_user_header %} 11 | 12 | {% block navbar_profile_authenticated_user_body '' %} 13 | 14 | {% block navbar_profile_authenticated_user_footer %} 15 | 31 | {% endblock navbar_profile_authenticated_user_footer %} 32 | -------------------------------------------------------------------------------- /Resources/views/Navbar/avatar_source.html.twig: -------------------------------------------------------------------------------- 1 | {{ asset('bundles/admingeneratorgenerator/img/unauthenticated.png') }} 2 | -------------------------------------------------------------------------------- /Resources/views/Navbar/layout.html.twig: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /Resources/views/Navbar/not_authenticated.html.twig: -------------------------------------------------------------------------------- 1 | {% if admingenerator_config('login_route') %} 2 | {% block navbar_profile_not_authenticated_user_header%} 3 |
  • 4 | {% block navbar_profile_not_authenticated_user_header_inner %} 5 | Unauthenticated user 6 |

    7 | {{ 'profile.unauthenticated'|trans({}, 'Admingenerator') }} 8 |

    9 | {% endblock navbar_profile_not_authenticated_user_header_inner %} 10 |
  • 11 | {% endblock navbar_profile_not_authenticated_user_header %} 12 | 13 | {% block navbar_profile_not_authenticated_user_body '' %} 14 | 15 | {% block navbar_profile_not_authenticated_user_footer %} 16 | 25 | {% endblock navbar_profile_not_authenticated_user_footer %} 26 | {% endif %} -------------------------------------------------------------------------------- /Resources/views/Sidebar/authenticated.html.twig: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | Authenticated user 4 |
    5 |
    6 |

    {{ app.user }}

    7 |
    8 |
    9 | -------------------------------------------------------------------------------- /Resources/views/Sidebar/avatar_source.html.twig: -------------------------------------------------------------------------------- 1 | {{ asset('bundles/admingeneratorgenerator/img/unauthenticated.png') }} 2 | -------------------------------------------------------------------------------- /Resources/views/Sidebar/layout.html.twig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Resources/views/Sidebar/not_authenticated.html.twig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Resources/views/Sidebar/not_authenticated.html.twig -------------------------------------------------------------------------------- /Resources/views/flash.html.twig: -------------------------------------------------------------------------------- 1 | {% block flash_message_success %} 2 |
    3 | 4 | 5 | {{ flashMessage }} 6 |
    7 | {% endblock %} 8 | 9 | {% block flash_message_error %} 10 |
    11 | 12 | 13 | {{ flashMessage }} 14 |
    15 | {% endblock %} 16 | 17 | {% block flash_messages %} 18 |
    19 |
    20 | {% for type, flashMessages in app.session.flashbag.all() %} 21 | {% for flashMessage in flashMessages %} 22 | {{ block('flash_message_' ~ type) }} 23 | {% endfor %} 24 | {% endfor %} 25 |
    26 |
    27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /Resources/views/header.html.twig: -------------------------------------------------------------------------------- 1 |
    2 | {% block logo %} 3 | {% set brand_path = (admingenerator_config('dashboard_route') is not null) ? path(admingenerator_config('dashboard_route')) : '#' %} 4 | 9 | {% endblock %} 10 | {% block navbar %} 11 | {% include "@AdmingeneratorGenerator/Navbar/layout.html.twig" %} 12 | {% endblock navbar %} 13 |
    -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ActionsTemplate/ActionsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/stylesheets.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/javascripts.php.twig' %} 3 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ActionsTemplate/form.php.twig' %} 4 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ActionsTemplate/title.php.twig' %} 5 | 6 | {{ echo_extends( builder.getBaseAdminTemplate ) }} 7 | 8 | {{ echo_block("stylesheets") }} 9 | {{- block('complementary_stylesheets') -}} 10 | {{ echo_endblock() }} 11 | 12 | {{ echo_block("javascripts") }} 13 | {{- block('complementary_javascripts') -}} 14 | {{ echo_endblock() }} 15 | 16 | {{- block('site_title') -}} 17 | 18 | {{- block('page_title') -}} 19 | 20 | {{ echo_block("page_content") }} 21 |
    22 | {{ echo_twig("block('form_' ~ actionParams.action)") }} 23 |
    24 | {{ echo_endblock() }} 25 | 26 | {% for action in builder.ObjectActions %} 27 | {{ echo_block('form_' ~ action.name|lower) }} 28 |
    29 | {{- block('form') -}} 30 |
    31 | {{ echo_endblock() }} 32 | {% endfor %} 33 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ActionsTemplate/form.php.twig: -------------------------------------------------------------------------------- 1 | {% block form %} 2 |
    3 |
    4 |
    5 | 6 | {{ echo_block('form_fields_' ~ action.name) }}{{ echo_endblock() }} 7 |
    8 | 17 |
    18 |
    19 | {% endblock %} 20 | 21 | {% block form_actions %} 22 | 25 | 26 | {{ echo_trans('action.custom.cancel') }} 27 | 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ActionsTemplate/title.php.twig: -------------------------------------------------------------------------------- 1 | {% block page_title %} 2 | {{ echo_block("page_header_content") }} 3 |

    {{ echo_twig('title') }}

    4 | {{ echo_endblock() }} 5 | {% endblock %} 6 | 7 | {% block site_title %} 8 | {{ echo_block("title") }} 9 | {{ echo_twig('parent()') }} - {{ echo_twig('title') }} 10 | {{ echo_endblock() }} 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/EditAction/index.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/security_action.php.twig' %} 2 | {% block index_use %} 3 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 4 | use {{ builder.namespacePrefixWithSubfolder }}\{{ bundle_name }}\Form\Type\{{ builder.BaseGeneratorName ? builder.BaseGeneratorName ~ char(92) : "" }}EditType; 5 | {% endblock %} 6 | 7 | {% block index %} 8 | 9 | public function indexAction(Request $request, $pk) 10 | { 11 | $this->request = $request; 12 | 13 | ${{ builder.ModelClass }} = $this->getObject($pk); 14 | 15 | {% if concurrency_lock -%} 16 | $this->saveVersion($pk, ${{ builder.ModelClass }}->getVersion()); 17 | {%- endif %} 18 | 19 | if (!${{ builder.ModelClass }}) { 20 | throw new NotFoundHttpException("The \{{ model }} with {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} $pk can't be found"); 21 | } 22 | 23 | {{ block('security_action_with_object') }} 24 | 25 | $this->preBindRequest(${{ builder.ModelClass }}); 26 | $form = $this->getEditForm(${{ builder.ModelClass }}); 27 | 28 | return $this->render('{% if builder.bundleContext %}@{{ builder.namespacePrefixForTemplate }}{{ bundle_name|slice(0, -6) }}/{% endif %}{{ builder.BaseGeneratorName }}Edit/index.html.twig', $this->getAdditionalRenderParameters(${{ builder.ModelClass }}) + array( 29 | "{{ builder.ModelClass }}" => ${{ builder.ModelClass }}, 30 | 'updateUrl' => $this->getUpdateUrl($pk), 31 | "form" => $form->createView() 32 | )); 33 | } 34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use "@AdmingeneratorGenerator/templates/CommonAdmin/EditTemplate/fieldsets.php.twig" %} 2 | 3 | 4 | {% block form %} 5 | {{ echo_block('form_fields') }} 6 | {{ echo_twig("form_errors(form)") }} 7 | {{- block('form_fieldsets') }} 8 | {{ echo_twig("form_rest(form)") }} 9 | {{ echo_endblock() }} 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/EditType/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/EditType/type.php.twig' %} 2 | 3 | {{- block('type') -}} 4 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/FiltersType/FiltersBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/FiltersType/type.php.twig' %} 2 | 3 | {{- block('type') -}} 4 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListAction/index.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/security_action.php.twig' %} 2 | 3 | {% block index_use %} 4 | use {{ builder.namespacePrefixWithSubfolder }}\{{ bundle_name }}\Form\Type\{{ builder.BaseGeneratorName ? builder.BaseGeneratorName ~ char(92) : "" }}FiltersType; 5 | {% endblock %} 6 | 7 | {% block index %} 8 | 9 | public function indexAction(Request $request) 10 | { 11 | $this->request = $request; 12 | {{ block('security_action') }} 13 | 14 | $this->parseRequestForPager(); 15 | 16 | // Scopes have to be processed before the filter form is initialized 17 | // so default scopes are synchronized with filters. 18 | $scopes = $this->getScopes(); 19 | $form = $this->getFilterForm(); 20 | 21 | return $this->render('{% if builder.bundleContext %}@{{ builder.namespacePrefixForTemplate }}{{ bundle_name|slice(0, -6) }}/{% endif %}{{ builder.BaseGeneratorName }}List/index.html.twig', $this->getAdditionalRenderParameters() + array( 22 | '{{ builder.ModelClass }}s' => $this->getPager(), 23 | 'listRoute' => $this->getListRoute(), 24 | 'filtersUrl' => $this->getFiltersUrl(), 25 | 'form' => $form->createView(), 26 | 'sortColumn' => $this->getSortColumn(), 27 | 'sortOrder' => $this->getSortOrder(), 28 | 'scopes' => $scopes, 29 | 'perPageChoices' => $this->getPerPageChoices(), 30 | )); 31 | } 32 | {% endblock %} 33 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListAction/sorter.php.twig: -------------------------------------------------------------------------------- 1 | {% block sorter %} 2 | /** 3 | * Store in the session service the current sort 4 | * 5 | * @param string $column The column 6 | * @param string $order_by The order sorting (ASC,DESC) 7 | */ 8 | protected function setSort($column, $order_by) 9 | { 10 | $this->getSession()->set($this->getSessionPrefix().'List\Sort', $column); 11 | 12 | if ($order_by == 'desc') { 13 | $this->getSession()->set($this->getSessionPrefix().'List\OrderBy', 'DESC'); 14 | } else { 15 | $this->getSession()->set($this->getSessionPrefix().'List\OrderBy', 'ASC'); 16 | } 17 | } 18 | 19 | /** 20 | * Return the stored sort 21 | * 22 | * @return string The column to sort 23 | */ 24 | protected function getSortColumn() 25 | { 26 | {% if sort is defined and sort is not null and sort[0] != '' -%} 27 | 28 | return $this->getSession()->get($this->getSessionPrefix().'List\Sort', '{{ sort[0] }}'); 29 | {% else -%} 30 | 31 | return $this->getSession()->get($this->getSessionPrefix().'List\Sort'); 32 | {% endif -%} 33 | } 34 | 35 | /** 36 | * Return the stored sort order 37 | * 38 | * @return string the order mode ASC|DESC 39 | */ 40 | protected function getSortOrder() 41 | { 42 | {% if sort is defined and sort[1] is defined -%} 43 | 44 | return $this->getSession()->get($this->getSessionPrefix().'List\OrderBy', '{{ sort[1] }}'); 45 | {% else -%} 46 | 47 | return $this->getSession()->get($this->getSessionPrefix().'List\OrderBy', 'ASC'); 48 | {% endif -%} 49 | } 50 | 51 | {% endblock %} 52 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/scopes.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/stylesheets.php.twig' %} 3 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/javascripts.php.twig' %} 4 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/title.php.twig' %} 5 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/modals.php.twig' %} 6 | 7 | {{ echo_extends( builder.getBaseAdminTemplate ) }} 8 | 9 | {{ echo_block("stylesheets") }} 10 | {{- block('complementary_stylesheets') -}} 11 | {{ echo_endblock() }} 12 | 13 | {{ echo_block("javascripts") }} 14 | {{- block('complementary_javascripts') -}} 15 | {{ echo_endblock() }} 16 | 17 | {{- block('site_title') -}} 18 | 19 | {{- block('page_title') -}} 20 | 21 | {{ echo_block("page_content") }} 22 | {{- block('list_scopes') -}} 23 |
    24 | {% set filtersInclude = builder.BaseGeneratorName ~ 'List/filters.html.twig' %} 25 | {% set resultsInclude = builder.BaseGeneratorName ~ 'List/results.html.twig' %} 26 | {% if builder.bundleContext %} 27 | {% set filtersInclude = '@' ~ builder.namespacePrefixForTemplate ~ bundle_name|slice(0, -6) ~ '/' ~ filtersInclude %} 28 | {% set resultsInclude = '@' ~ builder.namespacePrefixForTemplate ~ bundle_name|slice(0, -6) ~ '/' ~ resultsInclude %} 29 | {% endif %} 30 | 31 | {{ echo_include(filtersInclude) }} 32 | {{ echo_include(resultsInclude) }} 33 |
    34 | {{ echo_endblock() }} 35 | 36 | {{- block('modals') -}} 37 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/row.php.twig' %} 2 | 3 | {% block list_row %} 4 | {{ echo_block('list_row') }} 5 | 6 | {{- block('list_row_content') -}} 7 | 8 | {{ echo_endblock() }} 9 | {% endblock list_row %} 10 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/column.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/columns.php.twig' %} 2 | 3 | {% block column_default %} 4 | {{ echo_block('list_td_column_' ~ column.name) -}} 5 | {{- block('printable_columns') -}} 6 | {{- echo_endblock() }} 7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/footer.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/paginator.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/batch_actions.php.twig' %} 3 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/generic_actions.php.twig' %} 4 | 5 | {% block list_footer %} 6 | {{ echo_block("list_footer") }} 7 |
    8 |
    9 | {{ echo_block("batch_actions_wrapper") }} 10 | {% if builder.batchActions|default is not empty %} 11 |
    12 | {{ block('batch_actions') }} 13 | {{ block('batch_actions_script') }} 14 |
    15 | {% endif -%} 16 | {{ echo_endblock() }} 17 | {{ echo_block("generic_actions_wrapper") }} 18 | {% if builder.actions|default is not empty %} 19 |
    20 | {{ block('generic_actions') -}} 21 | {{ block('generic_actions_script') }} 22 |
    23 | {% endif -%} 24 | {{ echo_endblock() }} 25 |
    26 |
    27 |
    28 | {{ echo_block("pagination_wrapper") }} 29 |
    30 | {{ block('list_paginator') }} 31 |
    32 | {{ echo_endblock() }} 33 |
    34 | {{ echo_endblock() }} 35 | {% endblock %} -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/form.php.twig: -------------------------------------------------------------------------------- 1 | {% block form_batch_actions %} 2 | {{ echo_block("form_batch_actions") }} 3 | {% if batch_actions|default is not empty %} 4 | {% set actionPathName = builder.baseActionsRoute ~ '_batch' %} 5 |
    6 | 7 | {% endif %} 8 | {{ echo_endblock() }} 9 | {% endblock %} 10 | 11 | {% block endform_batch_actions %} 12 | {{ echo_block("endform_batch_actions") }} 13 | {% if batch_actions|default is not empty %} 14 |
    15 | {% endif %} 16 | {{ echo_endblock() }} 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/nbresults.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_nbresults %} 2 | {{ echo_block("list_nbresults") }} 3 |

    4 | {{ echo_block("list_nbresults_text") }} 5 | {{ echo_set("count", builder.ModelClass ~ "s.nbResults", false ) }} 6 | {{ echo_set("start", "( " ~ builder.ModelClass ~ "s.currentPage - 1 ) * " ~ builder.ModelClass ~ "s.maxPerPage + 1", false ) }} 7 | {{ echo_set("end", "start + " ~ builder.ModelClass ~ "s.maxPerPage - 1", false ) }} 8 | {{ echo_set("end", "end > count ? count : end", false) }} 9 | 10 | {{ echo_if ( builder.ModelClass ~ "s.haveToPaginate") }} 11 | {{ echo_trans("list.display.range|{ start, end, count }|") }} 12 | {{ echo_elseif (" count > 1 ") }} 13 | {{ echo_trans("list.display.all|{ count }|") }} 14 | {{ echo_else () }} 15 | {{ echo_trans("list.display.one|{ count }|") }} 16 | {{ echo_endif () }} 17 | {{ echo_endblock() }} 18 |

    19 | {{ echo_endblock() }} 20 | {% endblock %} 21 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/row.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/column.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/object_actions.php.twig' %} 3 | 4 | {% block list_row_content %} 5 | {{ echo_block("list_row_content") }} 6 | {% if builder.batchActions|default is not empty %} 7 | 8 | 9 | 10 | {% endif %} 11 | 12 | {% for column in builder.columns %} 13 | {% if column.credentials|default is not empty %} 14 | {{ echo_if_granted(column.credentials, builder.ModelClass) }} 15 | {% endif %} 16 | 17 | {{- block('column_default') -}} 18 | 19 | {% if column.credentials|default is not empty %} 20 | {{ echo_endif() }} 21 | {% endif %} 22 | {% endfor %} 23 | 24 | {%- if builder.objectActions|default is not empty %} 25 | {{ echo_block("list_row_actions") }} 26 | 27 |
    28 | {{ block('object_actions') }} 29 |
    30 | 31 | {{ echo_endblock() }} 32 | {% endif -%} 33 | {{ echo_endblock() }} 34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/scopes.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_scopes %} 2 | {{ echo_block("list_scopes") }} 3 | {% if scopes|default is not empty %} 4 | {% for groupName, group in scopes %} 5 | {{ echo_block("list_scopes_"~(groupName|classify|replace({'.': '_'})|lower)) }} 6 | 19 | {{ echo_endblock() }} 20 | {% endfor %} 21 | {% endif %} 22 | {{ echo_endblock() }} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ListTemplate/tbody.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/object_actions.php.twig' %} 2 | 3 | {% block list_tbody %} 4 | {{ echo_block("list_tbody") }} 5 | 6 | {{ echo_block("list_tbody_rows") }} 7 | {{ echo_if (builder.ModelClass ~ "s is not empty") }} 8 | {{ echo_for(builder.ModelClass, builder.ModelClass ~ "s" ) }} 9 | {% set rowInclude = builder.BaseGeneratorName ~ 'List/row.html.twig' %} 10 | {% if builder.bundleContext %} 11 | {% set rowInclude = '@' ~ builder.namespacePrefixForTemplate ~ bundle_name|slice(0, -6) ~ '/' ~ rowInclude %} 12 | {% endif %} 13 | {{ echo_include(rowInclude) }} 14 | {{ echo_endfor() }} 15 | {{ echo_else() }} 16 | 17 | {{ echo_trans('list.no.results') }} 18 | 19 | {{ echo_endif() }} 20 | {{ echo_endblock() }} 21 | 22 | {{ echo_endblock() }} 23 | {{ block('object_actions_script') }} 24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/NestedListAction/NestedListBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListAction/index.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/security_action.php.twig' %} 3 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/csrf_protection.php.twig' %} 4 | request = $request; 10 | {{ block('security_action') }} 11 | 12 | return $this->render('{% if builder.bundleContext %}@{{ builder.namespacePrefixForTemplate }}{{ bundle_name|slice(0, -6) }}/{% endif %}{{ builder.BaseGeneratorName }}List/index.html.twig', $this->getAdditionalRenderParameters() + array( 13 | '{{ builder.ModelClass }}s' => $this->getTree(), 14 | )); 15 | } 16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/NestedListTemplate/NestedListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/stylesheets.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/javascripts.php.twig' %} 3 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/title.php.twig' %} 4 | 5 | {{ echo_extends( builder.getBaseAdminTemplate ) }} 6 | 7 | {{ echo_block("stylesheets") }} 8 | {{- block('complementary_stylesheets') -}} 9 | {{ echo_endblock() }} 10 | 11 | {{ echo_block("javascripts") }} 12 | {{- block('complementary_javascripts') -}} 13 | {{ echo_endblock() }} 14 | 15 | {{- block('site_title') -}} 16 | 17 | {{- block('page_title') -}} 18 | 19 | {{ echo_block("page_content") }} 20 |
    21 | {% set resultsInclude = builder.BaseGeneratorName ~ 'List/results.html.twig' %} 22 | {% if builder.bundleContext %} 23 | {% set resultsInclude = '@' ~ builder.namespacePrefixForTemplate ~ bundle_name|slice(0, -6) ~ '/' ~ resultsInclude %} 24 | {% endif %} 25 | 26 | {{ echo_include(resultsInclude) }} 27 |
    28 | {{ echo_endblock() }} 29 | 30 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/modals.php.twig' %} 31 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/row.php.twig' %} 2 | 3 | {% block list_row %} 4 | {{ echo_block('list_row') }} 5 | 11 | {{- block('list_row_content') -}} 12 | 13 | {{ echo_endblock() }} 14 | {% endblock list_row %} -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/NestedListTemplate/footer.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/batch_actions.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/generic_actions.php.twig' %} 3 | 4 | {% block list_footer %} 5 | {{ echo_block("list_footer") }} 6 |
    7 |
    8 | {{ echo_block("batch_actions_wrapper") }} 9 | {% if builder.batchActions|default is not empty %} 10 |
    11 | {{ block('batch_actions') }} 12 | {{ block('batch_actions_script') }} 13 |
    14 | {% endif -%} 15 | {{ echo_endblock() }} 16 | {{ echo_block("generic_actions_wrapper") }} 17 | {% if builder.actions|default is not empty %} 18 |
    19 | {{ block('generic_actions') -}} 20 | {{ block('generic_actions_script') }} 21 |
    22 | {% endif -%} 23 | {{ echo_endblock() }} 24 |
    25 |
    26 | {{ echo_endblock() }} 27 | {% endblock %} -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/NestedListTemplate/nbresults.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_nbresults %} 2 | {{ echo_block("list_nbresults") }} 3 |

    4 | {# Nestedset requiers a fake root node, which is hidden in the result table. See documentation. #} 5 | {{ echo_set("count", builder.ModelClass ~ "s.count - 1", false ) }} 6 | 7 | {{ echo_trans("list.display.all|{ count }|") }} 8 |

    9 | {{ echo_endblock() }} 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/NestedListTemplate/thead.php.twig: -------------------------------------------------------------------------------- 1 | {% block list_thead %} 2 | {{ echo_block("list_thead") }} 3 | 4 | {{ echo_block("list_thead_inner") }} 5 | {{ block('list_thead_content')}} 6 | {{ echo_endblock() }} 7 | 8 | {{ echo_endblock() }} 9 | {% endblock %} 10 | 11 | 12 | {% block list_thead_content %} 13 | 14 | {% if batch_actions|default is not empty %} 15 | 16 | 17 | 18 | {% endif %} 19 | {% for column in builder.columns -%} 20 | {{ block('list_thead_content_column') }} 21 | {% endfor -%} 22 | 23 | {%- if object_actions|default is not empty %} 24 | {{ echo_block("list_thead_actions") }} 25 | {{ echo_trans('list.header.actions') }} 26 | {{ echo_endblock() }} 27 | {% endif -%} 28 | 29 | {% endblock list_thead_content %} 30 | 31 | 32 | {% block list_thead_content_column %} 33 | {{ echo_block('list_thead_column_' ~ (column.name|lower)) -}} 34 | {% if column.credentials|default is not empty %} 35 | {{ echo_if_granted(column.credentials) }} 36 | {% endif %} 37 | 38 | {{ echo_twig("'" ~ column.label|addslashes ~ "'|trans({}, '" ~ i18n_catalog|default("Admin") ~ "')") }} 39 | 40 | {% if column.credentials|default is not empty %} 41 | {{ echo_endif() }} 42 | {% endif %} 43 | {{ echo_endblock() }} 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/NewAction/index.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/security_action.php.twig' %} 2 | {% block index_use %} 3 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 4 | use {{ builder.namespacePrefixWithSubfolder }}\{{ bundle_name }}\Form\Type\{{ builder.BaseGeneratorName ? builder.BaseGeneratorName ~ char(92) : "" }}NewType; 5 | {% endblock %} 6 | {% block index %} 7 | 8 | public function indexAction(Request $request) 9 | { 10 | $this->request = $request; 11 | {{ block('security_action') }} 12 | 13 | ${{ builder.ModelClass }} = $this->getNewObject(); 14 | 15 | $this->preBindRequest(${{ builder.ModelClass }}); 16 | $form = $this->getNewForm(${{ builder.ModelClass }}); 17 | 18 | return $this->render('{% if builder.bundleContext %}@{{ builder.namespacePrefixForTemplate }}{{ bundle_name|slice(0, -6) }}/{% endif %}{{ builder.BaseGeneratorName }}New/index.html.twig', $this->getAdditionalRenderParameters(${{ builder.ModelClass }}) + array( 19 | '{{ builder.ModelClass }}' => ${{ builder.ModelClass }}, 20 | 'createUrl' => $this->getCreateUrl(), 21 | 'form' => $form->createView(), 22 | )); 23 | } 24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/PrintableColumns/boolean.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_boolean %} 2 | {{- echo_if(builder.ModelClass ~ '.' ~ column.getter) -}} 3 | 4 | {{- echo_else() -}} 5 | 6 | {{- echo_endif() -}} 7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/PrintableColumns/collection.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_collection %} 2 |
      3 | {{- echo_for('object', builder.ModelClass ~ '.' ~ column.getter ) -}} 4 |
    • {{ echo_twig('object') }}
    • 5 | {{- echo_endfor() -}} 6 |
    7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/PrintableColumns/columns.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/boolean.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/date.php.twig' %} 3 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/datetime.php.twig' %} 4 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/money.php.twig' %} 5 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/decimal.php.twig' %} 6 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/collection.php.twig' %} 7 | 8 | {% block printable_columns %} 9 | {%- if column.customView != null and builder.variable('custom_blocks') != null -%} 10 | {{- echo_use(builder.variable('custom_blocks')) -}} 11 | {{- echo_set('field_value', builder.ModelClass ~ '.' ~ column.getter, false) -}} 12 | {{- echo_print_block('column_' ~ column.customView|lower) -}} 13 | {%- elseif column.dbType|lower == "boolean" -%} 14 | {{- block('column_boolean') -}} 15 | {%- elseif (column.dbType|lower == "date") or (column.dbType|lower == "date_immutable") -%} 16 | {{- block('column_date') -}} 17 | {%- elseif (column.dbType|lower == "datetime") or (column.dbType|lower == "timestamp") or (column.dbType|lower == "vardatetime") or (column.dbType|lower == "datetimetz") or (column.dbType|lower == "datetime_immutable") -%} 18 | {{- block('column_datetime') -}} 19 | {%- elseif column.formType|lower == "money" or (column.formType == "Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType") -%} 20 | {{- block('column_money') -}} 21 | {%- elseif column.dbType|lower == "decimal" -%} 22 | {{- block('column_decimal') -}} 23 | {%- elseif (column.dbType|lower == "array") or (column.dbType|lower == "collection") -%} 24 | {{- block('column_collection') -}} 25 | {%- else -%} 26 | {{- echo_twig(builder.ModelClass ~ '.' ~ column.getter) -}} 27 | {%- endif -%} 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/PrintableColumns/date.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_date %} 2 | {%- if builder.generator.bundleConfig.twig.use_localized_date == true -%} 3 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 4 | {%- if column.localized_date_format is defined -%} 5 | {{ echo_set('localized_date_format', column.formOptions.localized_date_format) }} 6 | {%- else -%} 7 | {{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }} 8 | {%- endif -%} 9 | {%- if column.formOptions.format is defined -%} 10 | {{ echo_set('date_format', column.formOptions.format) }} 11 | {%- else -%} 12 | {{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }} 13 | {%- endif -%} 14 | 15 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_date(localized_date_format, pattern=date_format)') }} 16 | {{ echo_endif() }} 17 | {%- else -%} 18 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 19 | {%- if column.formOptions.format is defined -%} 20 | {{ echo_set('date_format', column.formOptions.format) }} 21 | {%- else -%} 22 | {{ echo_set('date_format', builder.generator.bundleConfig.twig.date_format) }} 23 | {%- endif -%} 24 | 25 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(date_format)') }} 26 | {{- echo_endif() }} 27 | {%- endif -%} 28 | {% endblock %} 29 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/PrintableColumns/datetime.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_datetime %} 2 | {% if builder.generator.bundleConfig.twig.use_localized_date == true -%} 3 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 4 | {%- if column.localized_date_format is defined -%} 5 | {{ echo_set('localized_date_format', column.formOptions.localized_date_format) }} 6 | {%- else -%} 7 | {{ echo_set('localized_date_format', builder.generator.bundleConfig.twig.localized_date_format) }} 8 | {%- endif -%} 9 | {%- if column.localized_time_format is defined -%} 10 | {{ echo_set('localized_time_format', column.formOptions.localized_datetime_format) }} 11 | {%- else -%} 12 | {{ echo_set('localized_time_format', builder.generator.bundleConfig.twig.localized_datetime_format) }} 13 | {%- endif -%} 14 | {%- if column.formOptions.format is defined -%} 15 | {{ echo_set('datetime_format', column.formOptions.format) }} 16 | {%- else -%} 17 | {{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }} 18 | {%- endif -%} 19 | 20 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|format_datetime(localized_date_format, localized_time_format, pattern=datetime_format)') }} 21 | {{ echo_endif() }} 22 | {%- else -%} 23 | {{ echo_if (builder.ModelClass ~ '.' ~ column.getter) }} 24 | {% if column.formOptions.format is defined %} 25 | {{ echo_set('datetime_format', column.formOptions.format) }} 26 | {% else %} 27 | {{ echo_set('datetime_format', builder.generator.bundleConfig.twig.datetime_format) }} 28 | {% endif %} 29 | 30 | {{ echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ '|date(datetime_format)') }} 31 | {{ echo_endif() }} 32 | {%- endif %} 33 | {% endblock %} 34 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/PrintableColumns/decimal.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_decimal %} 2 | {{- echo_twig(builder.ModelClass ~ '.' ~ column.getter ~ "|number_format(" ~ 3 | column.formOptions.precision|default(admingenerator_config('twig.number_format.decimal')) ~ ", '" ~ 4 | admingenerator_config('twig.number_format.decimal_point') ~ "', '" ~ 5 | admingenerator_config('twig.number_format.thousand_separator')~ "')") -}} 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/PrintableColumns/money.php.twig: -------------------------------------------------------------------------------- 1 | {% block column_money %} 2 | {% set currency = column.formOptions.currency|default('EUR') %} 3 | {% set precision = column.formOptions.precision|default(2) %} 4 | {% set grouping = column.formOptions.grouping|default(true) %} 5 | {% set divisor = column.formOptions.divisor|default(1) %} 6 | 7 | {{- echo_twig('localized_money('~ builder.ModelClass~'.'~column.getter ~', "'~ currency ~'", "'~ precision ~'", '~ grouping ~', '~ divisor ~')') -}} 8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ShowAction/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/ShowAction/index.php.twig' %} 2 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/security_action.php.twig' %} 3 | request = $request; 11 | ${{ builder.ModelClass }} = $this->getObject($pk); 12 | 13 | if (!${{ builder.ModelClass }}) { 14 | throw new NotFoundHttpException("The \{{ model }} with {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} $pk can't be found"); 15 | } 16 | 17 | {{ block('security_action_with_object') }} 18 | 19 | return $this->render('{% if builder.bundleContext %}@{{ builder.namespacePrefixForTemplate }}{{ bundle_name|slice(0, -6) }}/{% endif %}{{ builder.BaseGeneratorName }}Show/index.html.twig', $this->getAdditionalRenderParameters(${{ builder.ModelClass }}) + array( 20 | '{{ builder.ModelClass }}' => ${{ builder.ModelClass }}, 21 | )); 22 | } 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ShowTemplate/column.php.twig: -------------------------------------------------------------------------------- 1 | {% use '@AdmingeneratorGenerator/templates/CommonAdmin/PrintableColumns/columns.php.twig' %} 2 | 3 | {% block show_column %} 4 | {{ echo_block('show_column_' ~ column.name) -}} 5 | {{- block('printable_columns') -}} 6 | {{- echo_endblock() }} 7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/ShowTemplate/sidebar.php.twig: -------------------------------------------------------------------------------- 1 | {% block show_sidebar %} 2 | {{ echo_block("show_sidebar") }} 3 | {% for name, widget in sidebar %} 4 | {% if widget.credentials|default is not empty %} 5 | {{ echo_if_granted(widget.credentials, builder.ModelClass) }} 6 | {% endif %} 7 |
    8 | 22 |
    23 | {% if widget.credentials|default is not empty %} 24 | {{ echo_endif () }} 25 | {% endif %} 26 | {% endfor %} 27 | {{ echo_endblock() }} 28 | {% endblock %} -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/csrf_protection.php.twig: -------------------------------------------------------------------------------- 1 | {% block csrf_protection_use %} 2 | use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException; 3 | {% endblock %} 4 | 5 | {% block csrf_check_token %} 6 | 7 | /** 8 | * Check crsf token provided for action 9 | * 10 | * @throw InvalidCsrfTokenException if token is invalid 11 | */ 12 | protected function isGeneratedCsrfTokenValid($intention) 13 | { 14 | if (!$this->isCsrfTokenValid($intention, $this->request->request->get('_csrf_token'))) { 15 | throw new InvalidCsrfTokenException(); 16 | } 17 | } 18 | 19 | {% endblock %} 20 | 21 | {% block csrf_action_check_token %} 22 | // Check CSRF token for action 23 | $this->isGeneratedCsrfTokenValid($this->request->getRequestUri()); 24 | {% endblock %} 25 | 26 | {% block csrf_action_check_batch_token %} 27 | // Check CSRF token for batch action 28 | $this->isGeneratedCsrfTokenValid('{{ builder.baseActionsRoute }}_batch'); 29 | {% endblock %} 30 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/javascripts.php.twig: -------------------------------------------------------------------------------- 1 | {% block complementary_javascripts %} 2 | {{ echo_twig('parent()') }} 3 | {% for js in builder.getJavascripts() %} 4 | 5 | {% endfor %} 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/stylesheets.php.twig: -------------------------------------------------------------------------------- 1 | {% block complementary_stylesheets %} 2 | {{ echo_twig('parent()') }} 3 | {% for css in builder.getStylesheets() %} 4 | 5 | {% endfor %} 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /Resources/views/templates/CommonAdmin/title.php.twig: -------------------------------------------------------------------------------- 1 | {% block page_title %} 2 | {{ echo_block("page_header_content") }} 3 |

    {% if title|default is not empty %}{{ echo_trans(title, {}, i18n_catalog|default("Admin"), 'html' ) }}{% endif %}

    4 | {{ echo_endblock() }} 5 | {% endblock %} 6 | 7 | {% block site_title %} 8 | {{ echo_block("title") }} 9 | {{ echo_twig('parent()') }} - {% if title|default is not empty %}{{ echo_trans(title, {}, i18n_catalog|default("Admin"), 'html' ) }}{% endif %} 10 | {{ echo_endblock() }} 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/ActionsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ActionsTemplate/ActionsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/Edit/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/EditBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditTemplate/EditBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditType/EditBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/ExcelBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ExcelAction/ExcelBuilderAction.php.twig' %} 2 | 3 | {% block getResults %} 4 | protected function getResults() 5 | { 6 | return $this->getQuery()->getResult(); 7 | } 8 | {% endblock %} -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/FiltersBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/FiltersType/FiltersBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/List/FiltersBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/FiltersBuilderTemplate.php.twig' %} -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/List/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/List/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/NestedList/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/NestedList/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/NestedListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/NestedListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/NewBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NewAction/NewBuilderAction.php.twig' %} 2 | 3 | {% block saveObject -%} 4 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 5 | { 6 | $em = $this->doctrine->getManagerForClass('{{ model }}'); 7 | $em->persist(${{ builder.ModelClass }}); 8 | $em->flush(); 9 | } 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ShowAction/ShowBuilderAction.php.twig' %} 2 | {% block getObject -%} 3 | /** 4 | * Get object \{{ model }} with identifier $pk 5 | * 6 | * @param mixed $pk 7 | * @return \{{ model }} 8 | */ 9 | protected function getObject($pk) 10 | { 11 | return $this->getQuery($pk)->getOneOrNullResult(); 12 | } 13 | {% endblock %} 14 | 15 | 16 | {% block getQuery -%} 17 | /** 18 | * Get query from query builder 19 | * 20 | * @param mixed $pk 21 | * @return Doctrine\ORM\Query 22 | */ 23 | protected function getQuery($pk) 24 | { 25 | return $this->getQueryBuilder($pk)->getQuery(); 26 | } 27 | 28 | /** 29 | * Creates a QueryBuilder instance filtering on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} 30 | * property. 31 | * 32 | * @param mixed $pk 33 | * @return Doctrine\ORM\QueryBuilder 34 | */ 35 | protected function getQueryBuilder($pk) 36 | { 37 | return $this->doctrine 38 | ->getManagerForClass('{{ model }}') 39 | ->getRepository('{{ model }}') 40 | ->createQueryBuilder('q') 41 | ->where('q.{{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} = :pk') 42 | ->setParameter(':pk', $pk); 43 | } 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /Resources/views/templates/Doctrine/ShowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ShowTemplate/ShowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/ActionsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ActionsTemplate/ActionsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/Edit/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/EditBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditAction/EditBuilderAction.php.twig' %} 2 | 3 | {% block orm_use %} 4 | use Doctrine\ODM\MongoDB\LockMode; 5 | use Doctrine\ODM\MongoDB\LockException; 6 | {% endblock %} 7 | 8 | {% block getObject -%} 9 | /** 10 | * Get object \{{ model }} with identifier $pk 11 | * 12 | * @param mixed $pk 13 | * @return \{{ model }} 14 | */ 15 | protected function getObject($pk) 16 | { 17 | $pk = is_numeric($pk) ? intval($pk) : $pk; 18 | 19 | return $this->getQuery($pk)->getSingleResult(); 20 | } 21 | {% endblock %} 22 | 23 | {% block getQuery -%} 24 | /** 25 | * Get query from query builder 26 | * 27 | * @param mixed $pk 28 | * @return Doctrine\ODM\Query 29 | */ 30 | protected function getQuery($pk) 31 | { 32 | return $this->getQueryBuilder($pk)->getQuery(); 33 | } 34 | 35 | /** 36 | * Creates a QueryBuilder instance filtering on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} 37 | * property. 38 | * 39 | * @param mixed $pk 40 | * @return Doctrine\ODM\QueryBuilder 41 | */ 42 | protected function getQueryBuilder($pk) 43 | { 44 | return $this->getDocumentManager() 45 | ->getRepository('{{ model }}') 46 | ->createQueryBuilder() 47 | ->field('{{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }}')->equals($pk); 48 | } 49 | {% endblock %} 50 | 51 | {% block saveObject -%} 52 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 53 | { 54 | $dm = $this->getDocumentManager(); 55 | $dm->persist(${{ builder.ModelClass }}); 56 | $dm->flush(); 57 | } 58 | {% endblock %} 59 | 60 | {% block checkVersion -%} 61 | $this->getDocumentManager()->lock(${{ builder.ModelClass }}, LockMode::OPTIMISTIC, $versions[$pk]); 62 | {% endblock %} 63 | 64 | {% block lockException %}LockException{% endblock %} 65 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/EditBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditTemplate/EditBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditType/EditBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/ExcelBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ExcelAction/ExcelBuilderAction.php.twig' %} 2 | 3 | {% block getResults %} 4 | protected function getResults() 5 | { 6 | return $this->getQuery()->getResult(); 7 | } 8 | {% endblock %} -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/FiltersBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/FiltersType/FiltersBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/List/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/List/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/NestedList/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/NestedList/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/NewBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NewAction/NewBuilderAction.php.twig' %} 2 | 3 | {% block saveObject -%} 4 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 5 | { 6 | $em = $this->getDocumentManager(); 7 | $em->persist(${{ builder.ModelClass }}); 8 | $em->flush(); 9 | } 10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ShowAction/ShowBuilderAction.php.twig' %} 2 | 3 | {% block getObject -%} 4 | /** 5 | * Get object \{{ model }} with identifier $pk 6 | * 7 | * @param mixed $pk 8 | * @return \{{ model }} 9 | */ 10 | protected function getObject($pk) 11 | { 12 | $pk = is_numeric($pk) ? intval($pk) : $pk; 13 | 14 | return $this->getQuery($pk)->getSingleResult(); 15 | } 16 | {% endblock %} 17 | 18 | {% block getQuery -%} 19 | /** 20 | * Get query from query builder 21 | * 22 | * @param mixed $pk 23 | * @return Doctrine\ODM\Query 24 | */ 25 | protected function getQuery($pk) 26 | { 27 | return $this->getQueryBuilder($pk)->getQuery(); 28 | } 29 | 30 | /** 31 | * Creates a QueryBuilder instance filtering on {{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }} 32 | * property. 33 | * 34 | * @param mixed $pk 35 | * @return Doctrine\ODM\QueryBuilder 36 | */ 37 | protected function getQueryBuilder($pk) 38 | { 39 | return $this->getDocumentManager() 40 | ->getRepository('{{ model }}') 41 | ->createQueryBuilder() 42 | ->field('{{ builder.getFieldGuesser().getModelPrimaryKeyName(model) }}')->equals($pk); 43 | } 44 | {% endblock %} 45 | -------------------------------------------------------------------------------- /Resources/views/templates/DoctrineODM/ShowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ShowTemplate/ShowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/EmptyBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | get('stop_loop')) { 18 | {% if generateBaseInProjectDir|default(false) -%} 19 | throw new CantGenerateException('Make sure to run the `admin:generate-base-classes` command if you are seeing this!'); 20 | {%- else -%} 21 | throw new CantGenerateException('Oops an error occurred in your configuration. If you\'re in prod try cache:warmup'); 22 | {%- endif %} 23 | 24 | } 25 | 26 | return $this->redirect($request->getRequestUri()."?stop_loop=true"); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/ActionsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ActionsTemplate/ActionsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/Edit/FormBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditTemplate/FormBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/EditBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditAction/EditBuilderAction.php.twig' %} 2 | 3 | {% block orm_use %} 4 | use \PropelException; 5 | {% endblock %} 6 | 7 | {% block getObject -%} 8 | protected function getObject($pk) 9 | { 10 | return $this->getQuery($pk)->findPk($pk); 11 | } 12 | {% endblock %} 13 | 14 | {% block getQuery -%} 15 | protected function getQuery($pk) 16 | { 17 | return \{{ model }}Query::create(); 18 | } 19 | {% endblock %} 20 | 21 | {% block saveObject -%} 22 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 23 | { 24 | ${{ builder.ModelClass }}->save(); 25 | } 26 | {% endblock %} 27 | 28 | {% block checkVersion -%} 29 | if (${{ builder.ModelClass }}->getVersion() !== $versions[$pk]) { 30 | throw new PropelException("The lock failed, version ".$versions[$pk]." was expected, but is actually ".${{ builder.ModelClass }}->getVersion()); 31 | } 32 | {% endblock %} 33 | 34 | {% block lockException %}PropelException{% endblock %} -------------------------------------------------------------------------------- /Resources/views/templates/Propel/EditBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditTemplate/EditBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/EditBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/EditType/EditBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/ExcelBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ExcelAction/ExcelBuilderAction.php.twig' %} 2 | 3 | {% block getResults %} 4 | protected function getResults() 5 | { 6 | return $this->getQuery()->find(); 7 | } 8 | {% endblock %} -------------------------------------------------------------------------------- /Resources/views/templates/Propel/FiltersBuilderType.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/FiltersType/FiltersBuilderType.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/List/FiltersBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/FiltersBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/List/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/List/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/ListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ListTemplate/ListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/NestedList/ResultsBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/ResultsBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/NestedList/RowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/RowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/NestedListBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListAction/NestedListBuilderAction.php.twig' %} 2 | 3 | {% block getQuery -%} 4 | protected function getQuery() 5 | { 6 | $query = $this->buildQuery(); 7 | 8 | return $query; 9 | } 10 | 11 | protected function buildQuery() 12 | { 13 | return \{{ model }}Query::create(); 14 | } 15 | 16 | protected function getTree() 17 | { 18 | return $this->getQuery()->findTree(); 19 | } 20 | {% endblock %} 21 | 22 | {% block addJoinFor -%} 23 | protected function addJoinFor($table, $query) 24 | { 25 | $query->leftJoin($table); 26 | } 27 | {% endblock %} 28 | 29 | {% block nested_moveAction -%} 30 | public function nested_moveAction($dragged, $action, $dropped) 31 | { 32 | if(!in_array($action, array('before', 'in', 'after'))) { 33 | throw new NotFoundHttpException("Unknown action"); 34 | } 35 | 36 | $dragged = $this->buildQuery()->findPk($dragged); 37 | $dropped = $this->buildQuery()->findPk($dropped); 38 | 39 | if (!$dragged || !$dropped) { 40 | throw new NotFoundHttpException("Could not find the nodes"); 41 | } 42 | 43 | switch($action) { 44 | case 'before': 45 | $dragged->moveToPrevSiblingOf($dropped); 46 | break; 47 | case 'in': 48 | $dragged->moveToFirstChildOf($dropped); 49 | break; 50 | case 'after': 51 | $dragged->moveToNextSiblingOf($dropped); 52 | break; 53 | } 54 | 55 | $dragged->save(); 56 | 57 | return new Response(); 58 | } 59 | {% endblock %} 60 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/NestedListBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NestedListTemplate/NestedListBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/NewBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/NewAction/NewBuilderAction.php.twig' %} 2 | 3 | {% block saveObject -%} 4 | protected function saveObject(\{{ model }} ${{ builder.ModelClass }}) 5 | { 6 | ${{ builder.ModelClass }}->save(); 7 | } 8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/ShowBuilderAction.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ShowAction/ShowBuilderAction.php.twig' %} 2 | 3 | {% block getObject -%} 4 | protected function getObject($pk) 5 | { 6 | return $this->getQuery($pk)->findPk($pk); 7 | } 8 | {% endblock %} 9 | 10 | {% block getQuery -%} 11 | protected function getQuery($pk) 12 | { 13 | return \{{ model }}Query::create(); 14 | } 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /Resources/views/templates/Propel/ShowBuilderTemplate.php.twig: -------------------------------------------------------------------------------- 1 | {% extends '@AdmingeneratorGenerator/templates/CommonAdmin/ShowTemplate/ShowBuilderTemplate.php.twig' %} 2 | -------------------------------------------------------------------------------- /Routing/NestedRoutingLoader.php: -------------------------------------------------------------------------------- 1 | actions['nested_move'] = array( 12 | 'path' => '/nested-move/{dragged}/{action}/{dropped}', 13 | 'defaults' => array(), 14 | 'requirements' => array(), 15 | 'methods' => array('GET'), 16 | 'controller' => 'list', 17 | ); 18 | 19 | return parent::load($resource, $type); 20 | } 21 | 22 | public function supports(mixed $resource, ?string $type = null): bool 23 | { 24 | return 'admingenerator_nested' == $type; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Tests/Builder/Fixtures/BaseBuilder.php.twig: -------------------------------------------------------------------------------- 1 | Hello {{ name }}! 2 | -------------------------------------------------------------------------------- /Tests/ClassLoader/AdmingeneratedClassLoaderTest.php: -------------------------------------------------------------------------------- 1 | register(realpath(sys_get_temp_dir())); 16 | $loader->loadClass($testClassName); 17 | $this->assertTrue(class_exists($className), $message); 18 | } 19 | 20 | public static function getLoadClassTests(): array 21 | { 22 | return [ 23 | [ 24 | '\\Admingenerated\\AdmingeneratorDemoBundle\\BaseController\\ListController', 25 | 'Admingenerated\\AdmingeneratorDemoBundle\\BaseController\\ListController', 26 | '->loadClass() loads admingenerated class' 27 | ], 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Tests/Filesystem/Fake/Empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Tests/Filesystem/Fake/Empty -------------------------------------------------------------------------------- /Tests/Filesystem/RelativePathComputerTest.php: -------------------------------------------------------------------------------- 1 | assertEquals(str_repeat('..' . DIRECTORY_SEPARATOR, 1), $computer->computeToParent(dirname($referencePath))); 16 | $this->assertEquals(str_repeat('..' . DIRECTORY_SEPARATOR, 3), $computer->computeToParent(dirname($referencePath, 3))); 17 | 18 | $referencePath = dirname($referencePath); 19 | $computer = new RelativePathComputer($referencePath); 20 | $this->assertEquals(str_repeat('..' . DIRECTORY_SEPARATOR, 1), $computer->computeToParent(dirname($referencePath))); 21 | $this->assertEquals(str_repeat('..' . DIRECTORY_SEPARATOR, 3), $computer->computeToParent(dirname($referencePath, 3))); 22 | } 23 | 24 | public function testExceptionThrowIfNotParent(): void 25 | { 26 | $computer = new RelativePathComputer(__FILE__); 27 | $this->expectException(LogicException::class); 28 | 29 | $computer->computeToParent(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Fake'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Tests/Generator/ActionTest.php: -------------------------------------------------------------------------------- 1 | 'name', 15 | 'underscored_name' => 'underscored_name', 16 | ]; 17 | 18 | $this->checkAction($from_to_array, 'getName'); 19 | } 20 | 21 | public function testGetLabel(): void 22 | { 23 | $from_to_array = [ 24 | 'name' => 'Name', 25 | 'underscored_name' => 'Underscored name', 26 | ]; 27 | 28 | $this->checkAction($from_to_array, 'getLabel'); 29 | } 30 | 31 | protected function checkAction(array $from_to_array, string $method): void 32 | { 33 | foreach ($from_to_array as $from => $to) { 34 | $action = new Action($from); 35 | $this->assertEquals($to, $action->$method()); 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Tests/Mocks/Doctrine/DriverConnectionMock.php: -------------------------------------------------------------------------------- 1 | _platformMock) { 24 | $this->_platformMock = new DatabasePlatformMock; 25 | } 26 | 27 | return $this->_platformMock; 28 | } 29 | 30 | /* MOCK API */ 31 | public function getName() 32 | { 33 | return 'mock'; 34 | } 35 | 36 | public function getExceptionConverter(): ExceptionConverter 37 | { 38 | return new ExceptionConverterMock(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Tests/Mocks/Doctrine/ExceptionConverterMock.php: -------------------------------------------------------------------------------- 1 | id; 32 | } 33 | 34 | public function setTitle(string $title): void 35 | { 36 | $this->title = $title; 37 | } 38 | 39 | public function getTitle(): ?string 40 | { 41 | return $this->title; 42 | } 43 | 44 | public function setDesc(string $desc): void 45 | { 46 | $this->desc = $desc; 47 | } 48 | 49 | public function getDesc(): ?string 50 | { 51 | return $this->desc; 52 | } 53 | 54 | public function setIsPublished(?bool $isPublished): void 55 | { 56 | $this->is_published = $isPublished; 57 | } 58 | 59 | public function getIsPublished(): ?bool 60 | { 61 | return $this->is_published; 62 | } 63 | 64 | public function setProducer(?Producer $producer): self 65 | { 66 | $this->producer = $producer; 67 | 68 | return $this; 69 | } 70 | 71 | public function getProducer(): ?Producer 72 | { 73 | return $this->producer; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Tests/QueryFilter/Entity/MovieRepository.php: -------------------------------------------------------------------------------- 1 | id; 24 | } 25 | 26 | public function setName(string $name): void 27 | { 28 | $this->name = $name; 29 | } 30 | 31 | public function getName(): ?string 32 | { 33 | return $this->name; 34 | } 35 | 36 | public function setPublished(mixed $published): self 37 | { 38 | $this->published = !!$published; 39 | 40 | return $this; 41 | } 42 | 43 | public function isPublished(): bool 44 | { 45 | return $this->published; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Tests/TestCase.php: -------------------------------------------------------------------------------- 1 | false, 15 | ))); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Tests/Twig/Extension/ConfigExtensionTest.php: -------------------------------------------------------------------------------- 1 | ['val0' => 'val0FromArray1', 'val1' => 'val1FromArray1'], 18 | 'array2' => ['val0FromArray2', 'val1FromArray2'], 19 | ]; 20 | 21 | public function setUp(): void 22 | { 23 | $this->extension = new ConfigExtension($this->exampleConfig); 24 | } 25 | 26 | public function testGetAdmingeneratorConfig(): void 27 | { 28 | $this->assertEquals( 29 | $this->exampleConfig['array1']['val0'], 30 | $this->extension->getAdmingeneratorConfig('array1.val0') 31 | ); 32 | 33 | $this->assertEquals( 34 | $this->exampleConfig['array2'], 35 | $this->extension->getAdmingeneratorConfig('array2') 36 | ); 37 | } 38 | 39 | public function testGetAdmingeneratorConfigReturnsExceptionOnUnknownKey() 40 | { 41 | $this->expectException(InvalidArgumentException::class); 42 | $this->extension->getAdmingeneratorConfig('unknown.key'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Tests/Twig/Extension/TestObject.php: -------------------------------------------------------------------------------- 1 | 0, 11 | 'foo' => 0, 12 | 'getFooBar' => 0, 13 | ); 14 | 15 | public function __construct($bar = 'bar') 16 | { 17 | 18 | } 19 | 20 | public static function reset(): void 21 | { 22 | self::$called = [ 23 | '__toString' => 0, 24 | 'foo' => 0, 25 | 'getFooBar' => 0, 26 | ]; 27 | } 28 | 29 | public function __toString() 30 | { 31 | ++self::$called['__toString']; 32 | 33 | return 'foo'; 34 | } 35 | 36 | public function foo(): string 37 | { 38 | ++self::$called['foo']; 39 | 40 | return 'foo'; 41 | } 42 | 43 | public function getFooBar(): string 44 | { 45 | ++self::$called['getFooBar']; 46 | 47 | return 'foobar'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Tests/Twig/Fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/symfony2admingenerator/GeneratorBundle/a416f85312b02f16ed049073794360d83547c892/Tests/Twig/Fixtures/.gitkeep -------------------------------------------------------------------------------- /Tests/autoload.php.dist: -------------------------------------------------------------------------------- 1 | registerNamespaces(array( 18 | 'Symfony' => $vendorDir.'/symfony/src', 19 | 'BabDev\PagerfantaBundle' => $vendorDir, 20 | 'Pagerfanta' => $vendorDir.'/src', 21 | 'TwigGenerator' => $vendorDir.'/twig-generator/src', 22 | 'Doctrine\Common' => $vendorDir.'/doctrine-common/lib', 23 | 'Doctrine\DBAL' => $vendorDir.'/../vendor/doctrine-dbal/lib', 24 | 'Doctrine\Tests' => $vendorDir.'/doctrine/tests', 25 | 'Doctrine' => $vendorDir.'/doctrine/lib', 26 | )); 27 | $loader->registerPrefixes(array( 28 | 'Twig_' => array($vendorDir.'/twig/lib', $vendorDir.'/twig-extensions/lib'), 29 | )); 30 | $loader->register(); 31 | 32 | spl_autoload_register(function($class) { 33 | if (0 === strpos($class, 'Admingenerator\\GeneratorBundle\\')) { 34 | $path = __DIR__.'/../'.implode('/', array_slice(explode('\\', $class), 2)).'.php'; 35 | if (!stream_resolve_include_path($path)) { 36 | return false; 37 | } 38 | require_once $path; 39 | 40 | return true; 41 | } 42 | }); 43 | -------------------------------------------------------------------------------- /Tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | ['html']]; 16 | return [ 17 | 'classify' => new TwigFilter('classify', 18 | fn ($string) => InflectorFactory::create()->build()->classify($string), 19 | $options), 20 | ]; 21 | } 22 | } -------------------------------------------------------------------------------- /Twig/Extension/ConfigExtension.php: -------------------------------------------------------------------------------- 1 | ['html']]; 17 | return [ 18 | 'admingenerator_config' => new TwigFunction('admingenerator_config', $this->getAdmingeneratorConfig(...), $options), 19 | ]; 20 | } 21 | 22 | public function getAdmingeneratorConfig(string $name): array|string|null 23 | { 24 | $search_in = $this->bundleConfig; 25 | $path = explode('.', $name); 26 | foreach ($path as $key) { 27 | if (!array_key_exists($key, $search_in)) { 28 | throw new \InvalidArgumentException('Unknown parameter "admingenerator.' . $name . '".'); 29 | } 30 | $search_in = $search_in[$key]; 31 | } 32 | 33 | return $search_in; 34 | } 35 | 36 | public function getName(): string 37 | { 38 | return 'admingenerator_config'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Twig/Extension/CsrfTokenExtension.php: -------------------------------------------------------------------------------- 1 | ['html']]; 23 | return [ 24 | 'csrf_token' => new TwigFilter('csrf_token', $this->getCsrfToken(...), $options), 25 | ]; 26 | } 27 | 28 | public function getCsrfToken(string $intention): CsrfToken 29 | { 30 | return $this->csrfTokenManager->getToken($intention); 31 | } 32 | 33 | public function getName(): string 34 | { 35 | return 'admingenerator_csrf'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Twig/Extension/ExtendsAdmingeneratedExtension.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | class SecurityExtension extends AbstractExtension 13 | { 14 | 15 | public function __construct( 16 | private readonly AuthorizationCheckerInterface $authorizationChecker, 17 | private readonly bool $useExpression = false 18 | ) 19 | { 20 | } 21 | 22 | public function getFunctions(): array 23 | { 24 | return [ 25 | 'is_one_admingenerator_granted' => new TwigFunction('is_one_admingenerator_granted', $this->isOneGranted(...)), 26 | ]; 27 | } 28 | 29 | public function isOneGranted(array $credentials, ?object $object = null): bool 30 | { 31 | if (empty($credentials)) { 32 | return true; 33 | } 34 | 35 | foreach ($credentials as $credential) { 36 | if ('AdmingenAllowed' == $credential) { 37 | return true; 38 | } 39 | 40 | if ($this->useExpression) { 41 | $credential = new \JMS\SecurityExtraBundle\Security\Authorization\Expression\Expression($credential); 42 | } 43 | 44 | if ($this->authorizationChecker->isGranted($credential, $object)) { 45 | return true; 46 | } 47 | } 48 | 49 | return false; 50 | } 51 | 52 | public function getName(): string 53 | { 54 | return 'admingenerator_security'; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Twig/TokenParser/ExtendsAdmingeneratedTokenParser.php: -------------------------------------------------------------------------------- 1 | parser->getCurrentToken()->getValue()); //AcmeBundle:namespace:template.html.twig 18 | if (count($templateParts) !== 3) { 19 | list($bundle, $folder, $file) = explode('/', $this->parser->getCurrentToken()->getValue()); //@Acme/namespace/template.html.twig 20 | $bundle = sprintf('%sBundle', substr($bundle, 1)); 21 | } else { 22 | list($bundle, $folder, $file) = $templateParts; 23 | } 24 | 25 | $path = "Admingenerated/$bundle/Resources/views/$folder/$file"; 26 | 27 | $this->parser->getExpressionParser()->parseExpression(); 28 | 29 | $this->parser->setParent(new ConstantExpression($path,$token->getLine())); 30 | $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); 31 | 32 | return new EmptyNode($token->getLine()); 33 | } 34 | 35 | public function getTag(): string 36 | { 37 | return 'extends_admingenerated'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Validator/BaseValidator.php: -------------------------------------------------------------------------------- 1 | getGeneratorYml())); 13 | 14 | $yaml_path = explode('.',$yaml_path); 15 | foreach ($yaml_path as $key) { 16 | if (!isset($search_in[$key])) { 17 | return $default; 18 | } 19 | $search_in = $search_in[$key]; 20 | } 21 | 22 | return $search_in; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Validator/ModelClassValidator.php: -------------------------------------------------------------------------------- 1 | getFromYaml($generator, 'params.model')) { 13 | throw new ModelClassNotFoundException(sprintf('You should define params.model option in %s', $generator->getGeneratorYml())); 14 | } 15 | 16 | if (!class_exists($model)) { 17 | throw new ModelClassNotFoundException(sprintf('Unable to find class %s for %s', $model, $generator->getGeneratorYml())); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Validator/PropelModelClassValidator.php: -------------------------------------------------------------------------------- 1 | getFromYaml($generator, 'params.model'); 13 | $parts = explode('\\', $model); 14 | $modelName = $parts[sizeof($parts) -1]; 15 | unset($parts[sizeof($parts) -1]); 16 | 17 | $model = implode('\\', $parts).'\\om\\Base'.$modelName; 18 | 19 | if (!class_exists($model)) { 20 | throw new GeneratedModelClassNotFoundException(sprintf('Unable to find class %s for %s', $model, $generator->getGeneratorYml())); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Validator/ValidatorInterface.php: -------------------------------------------------------------------------------- 1 | " 6 | ], 7 | "description" : "Assets for the admingenerator bundle based on AdminLTE template", 8 | "dependencies": { 9 | "admin-lte": "~2", 10 | "ionicons": "~2", 11 | "jquery": "~1", 12 | "bootstrap": "~3", 13 | "font-awesome": "~6", 14 | "iCheck": "~1", 15 | "slimScroll": "~1", 16 | "jquery-resize": "v1.1", 17 | "html5shiv": "~3", 18 | "respond": "~1", 19 | "jquery-treetable": "~3" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | ./Tests 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------