Closed snuffer82 closed 9 months ago
They easiest fix would probably be to just create that directory and try to run composer again.
HI, Thanks for the reply. I tried to create the directory, now the error is:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In AdmingeneratorGeneratorExtension.php line 107:
!!
!! You must enable one model manager in Admingenerator config.
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
thanks!
You can ignore that for now and continue with steps outlined in the documentation: https://github.com/symfony2admingenerator/GeneratorBundle/blob/master/Resources/doc/install/base-installation.md. After you have created the basic configuration, the cache:clear command should work.
I don't have any config.yml ("Add following lines to app/config/config.yml:") Could you tell me where I should create it and what its content should be?
ps. I created a config.yaml in config/packages with this content: admingenerator_generator:
use_propel: false
use_doctrine_orm: true
use_doctrine_odm: false
# add this line if you want to use assetic
base_admin_template: AdmingeneratorGeneratorBundle::base_uncompressed.html.twig
but I get this error:
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In GeneratorCacheBuilder.php line 85:
!!
!! No configuration files found
!!
!!
!! 2024-01-31T21:58:11+00:00 [info] User Deprecated: The "Admingenerator\GeneratorBundle\CacheWarmer\GeneratorCacheWarmer::warmUp()" method will require a new "string|null $buildDir" argument in the next major version of its interface "Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface", not defining it is deprecated.
!!
Script @auto-scripts was called via post-update-cmd
app/config/config.yml
is indeed something from older Symfony versions (the documentation hasn't been updated in a while), you should now use config/packages/admingenerator.yml
instead. The config.yml
you've created also works, but renaming it to the package name makes it a bit more clear and matches with the current recommendations.
Regarding the error: you just need to create a first configuration. You might be able to do so with the command from the documentation (https://github.com/symfony2admingenerator/GeneratorBundle/blob/master/Resources/doc/getting-started/create-admin.md), otherwise you can do it manually.
Thank you for your support, however it continues to give me the last error reported, which is probably similar to this:
https://symfony.com/blog/new-in-symfony-6-4-build-dir-improvements#using-build-dir-to-generate-more-contents (the proposed solution does not work)
I understand that it is difficult to make it work with symfony 6.4 and it's a real shame because I can't find such a complete admin generator. Can you tell me what the latest version of symfony is that I can still use it with? Thanks
We are using it with Symfony 6.4 without issues, but that is a project that has been using this bundle since Symfony 2.
You can ignore the User Deprecated
regarding the build dir: it is just a notice and we will probably fix it in the next version.
The real error is that there were no definitions found. If you did not solve that by adding a configuration, you will keep getting this error, and it might actually prevent you from adding an actual configuration. Can you try to comment out this line https://github.com/symfony2admingenerator/GeneratorBundle/blob/master/CacheBuilder/GeneratorCacheBuilder.php#L85 in your local installation?
Thanks for the support, I was able to get it working without any problems! Paolo
That is great to hear! If there is anything that might need an update to help bootstrapping this more easily, feel free to open a PR!
Hi, here are some tips that make installation easier:
<?php
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application; use Admingenerator\GeneratorBundle\ClassLoader\AdmingeneratedClassLoader;
if (!is_file(dirname(DIR).'/vendor/autoload_runtime.php')) { throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); }
require_once dirname(DIR).'/vendor/autoload_runtime.php';
return function (array $context) { $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); AdmingeneratedClassLoader::initAdmingeneratorClassLoader($kernel->getCacheDir());
return new Application($kernel);
};
- in /public/index.php:
<?php
use App\Kernel; use Admingenerator\GeneratorBundle\ClassLoader\AdmingeneratedClassLoader;
require_once dirname(DIR).'/vendor/autoload_runtime.php';
return function (array $context) { $kernel = new App\Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); AdmingeneratedClassLoader::initAdmingeneratorClassLoader($kernel->getCacheDir()); return $kernel; };
- in DoctrineGenerator.php and Generator.php replaced $generator->getFromYaml('params.namespace_prefix') with ''
- fixed options_generator.tpl.php `namespace <?= $namespace ?>\Form\Type\<?= rtrim($prefix, '\\') ?>;`
@snuffer82 Thanks for the notes!
Except for the in DoctrineGenerator.php and Generator.php replaced $generator->getFromYaml('params.namespace_prefix') with ''
(I do not understand this one, the option in the yaml should be empty by default) everything was either already noted in the documentation or has been updated/fixed with #332.
I made that change because, in case of null, I got an error like: expects a string value, instead a null value is returned thanks
Rights, I see. Added that fix to the PR now as well, as some other fixes.
Hi, I'm trying to install it on a new symfony 6.4 project (php 8.3) . The installation fails with this error:
`/usr/bin/php8.3 /usr/local/bin/composer require symfony2admingenerator/generator-bundle Using version ^5.0 for symfony2admingenerator/generator-bundle ./composer.json has been updated Running composer update symfony2admingenerator/generator-bundle Loading composer repositories with package information Updating dependencies Lock file operations: 4 installs, 0 updates, 0 removals
composer fund
command to find out more!Symfony operations: 2 recipes (cfa79d6e3f27b385952b79af08b42eb7)
!! In Finder.php line 649: !!
!! The "/var/www/html/newproject/config/admin" directory does not exist.
!!
!!
!!
Script @auto-scripts was called via post-update-cmd`
Do you have any suggestions? Thanks Paolo