Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non standard bundle namespace, 500 error #708

Open
denys281 opened this issue Dec 19, 2013 · 11 comments
Open

Non standard bundle namespace, 500 error #708

denys281 opened this issue Dec 19, 2013 · 11 comments
Labels

Comments

@denys281
Copy link
Contributor

When I have bundle for example Acme/Backend/BlogBundle. On any action of this bundle symfony give 500.

 Opps an error occurred in your configuration. If you're in prod try cache:warmup
500 Internal Server Error - CantGenerateException 

But Acme/BackendBlogBundle works perfect.

Stack Trace

in kernel.root_dir/cache/dev/Admingenerated/Acme/BackendBlogBundle/BaseBlogController/ListController.php at line 16  -

Problem is that in cache Admingenerator generate folder with name AcmeBackend\BlogBundle

@ioleo
Copy link
Member

ioleo commented Dec 20, 2013

@denys281 please post the beggining of your generator.yml file (bundle name, namespace prefix, etc)

@denys281
Copy link
Contributor Author

@loostro

Bundle in Webmil/Backend/StaticBundle

generator: admingenerator.generator.doctrine
params:
    model: Webmil\Frontend\StaticBundle\Entity\StaticData
    namespace_prefix: Webmil
    concurrency_lock: ~
    bundle_name: Backend\StaticBundle
    pk_requirement: ~
    fields: ~
    object_actions:
        delete: ~
    batch_actions:
        delete: ~

@denys281
Copy link
Contributor Author

Ok, in Generator.php I try change

return $this->cache_dir.'/Admingenerated/'.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).$bundle_name;

to

       return $this->cache_dir.'/Admingenerated/'.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).str_replace('\\', DIRECTORY_SEPARATOR, $bundle_name);

And in start generate folder in cache like AcmeBackend/StaticBundle, but I have next error

FatalErrorException: Error: Call to undefined method Acme\Backend\StaticBundle\Form\Type\Static\FiltersType::setSecurityContext() in /home/dan/WEB/www/project/app/cache/dev/Admingenerated/AcmeBackend/StaticBundle/BaseStaticController/ListController.php line 425

_Update_: it generate wrong namespace in FiltersType.php:

 use Admingenerated\AcmeBackendStaticBundle\Form\BaseStaticType\FiltersType as BaseFiltersType;

I fix it manually and next error:

Unable to find template "AcmeBackend\StaticBundle:StaticList:index.html.twig". 

@ioleo
Copy link
Member

ioleo commented Apr 10, 2014

@denys281 what happens if you try:

generator: admingenerator.generator.doctrine
params:
    model: Webmil\Frontend\StaticBundle\Entity\StaticData
    namespace_prefix: Webmil\Backend # added Backend
    bundle_name: StaticBundle # removed Backend

@denys281
Copy link
Contributor Author

@loostro

Opps an error occurred in your configuration. If you're in prod try cache:warmup

@ioleo
Copy link
Member

ioleo commented Apr 11, 2014

Can you try also with double slashes Webmil\\Backend? And clear your cache to be sure everything is regenerated.

@denys281
Copy link
Contributor Author

same error.

@ioleo
Copy link
Member

ioleo commented Apr 11, 2014

Hmm.. just to be sure it's not escapeing characters problem, please try also with 3 \\\ and 4 \\\\ slashes.

@denys281
Copy link
Contributor Author

Same error.

@ioleo
Copy link
Member

ioleo commented Apr 11, 2014

Ok, the line

return $this->cache_dir.'/Admingenerated/'.str_replace('\\', DIRECTORY_SEPARATOR, $namespace).$bundle_name;

is fine, but something else is throwing an error and you get the EmptyBuilder generated...

@Apolide
Copy link

Apolide commented Apr 19, 2014

I've faced the same problem. Followed the official documentation at http://symfony2admingenerator.org/documentation/generator-params.html# and find out the param (subfolder) in generator.yml, that helps in a custom namespace tree.
My generator.yml looks now like this:

generator: admingenerator.generator.doctrine
params:
    model: Company\Bundle\AdminBundle\Entity\MyEntity
    namespace_prefix: Company
    subfolder: Bundle
    bundle_name: AdminBundle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants