symfony2admingenerator / GeneratorBundle

Admingenerator for Symfony. Parse YAML files to build customized backend.
MIT License
67 stars 29 forks source link

Cache Clear Issue #279

Closed ndoulgeridis closed 8 years ago

ndoulgeridis commented 8 years ago

Hello,

I am trying to migrate from old AdminGenerator migrating also from Symfony 2.8 to 3. All seems ok except the following:

When i run from windows: php bin/console cache:clear I get this error:

  [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
  "'BackEndBundle\\Form\\Type\\C:\\Wamp\\www\\XXXXX\\src\\XXXXBundle\\Resources\\config\\Test \\EditType'" is not a valid class name for the "admingen_generator_test_edit" service.

This is happening only from windows, instead if I run it from VM using ubuntu it works fine. The error is on:

\Admingenerator\GeneratorBundle\DependencyInjection\AdmingeneratorGeneratorExtension::registerFormsServicesFromGenerator  LINE 277 

where $generatorParameters['prefix'] is a full windows path to the file (in my error above is

\C:\\Wamp\\www\\XXXXX\\src\\XXXXBundle\\Resources\\config\\Test\\EditType)

Do I do something wrong or it's a known bug? From my research seems like the regex following is not consider a windows path:

vendor/symfony2admingenerator/generator-bundle/DependencyInjection/AdmingeneratorGeneratorExtension.php:254

preg_match('/[^\/]*-generator.yml/', $path, $prefix);

Maybe this regex has to change a bit to consider windows paths.

In old bundle this one was using instead:

preg_match('/(?:\/|\\\\)([^\/\\\\]+?)-generator.yml$/', $path, $prefix)
bobvandevijver commented 8 years ago

I'm not sure what the problem is, but it seems to be related to the Windows installation. Can you do some debugging and provide a solution? I do not have a Windows machine to test with unfortunately.

ioleo commented 8 years ago

I've opened a PR. Can you checkout this branch by changeing to "symfony2admingenerator/generator-bundle": "dev-bugs-279@dev" and test if this fixes your problem?