Jump to content

Using Doctrine (ORM) in a module


Recommended Posts

Hi,

 

What is the way to get ORM entities working in a module? Do you have to create the proxies yourself or is that done automatically?

 

Do I have to place them in a special directory?

 

SnefIT

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...

Hi,
I'm using Prestashop 1.7.5
To use Doctrine ORM in module there is some configuration must be edited in the "Project_dir/app/config/config.yml"

    orm:
        mappings:  # define custom mapping
            custom_mapping:
                type: annotation
                prefix: MyModule\Entity\  # define prefix to load your entityes from
                dir: "%kernel.project_dir%/modules/mymodule/src/Entity" # define directory to load your entityes from
                is_bundle: false # this is to tell orm that this is not a symfony bundle

so now after setting up your controllers and forms , you can take advantage of the full Symfony power in developing your module.

I know this is not a perfect solution, if any one has a way to do the same thing from the inside of the module that would be great 

Edited by ahmed_Rabii (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...