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

Overriding User #336

Closed
antonioperic opened this issue Sep 23, 2013 · 6 comments
Closed

Overriding User #336

antonioperic opened this issue Sep 23, 2013 · 6 comments
Labels
Help Wanted Issues needing help and clarification.

Comments

@antonioperic
Copy link
Contributor

Hi, i have problem with overriding user

I have new class for user, and XML for ORM

use Sylius\Bundle\CoreBundle\Model\User as BaseUser;

class User extends BaseUser
{
...
}

Also i have overridden Sylius.yml like this

sylius_resource:
    resources:
        sylius.user:
            classes:
                model: Locastic\CoreBundle\Entity\User

sylius_installer:
    classes:
        user:
            model: Locastic\CoreBundle\Entity\User   

But still get:

  [Doctrine\DBAL\Schema\SchemaException]                                  
  The table with name 'sylius_dev.sylius_user' already exists.  

This was working pretty well until I updated Sylius to new version and moved files to SRC folder

TY,
Antonio

@antonioperic
Copy link
Contributor Author

As I can see, model inherits well, but some parameters is missing for overriding, dont know which one :(

@antonioperic
Copy link
Contributor Author

Solution:

sylius_core:
    driver: doctrine/orm
    classes:
        user:
           model: Locastic\CoreBundle\Entity\User 

@pjedrzejewski
Copy link
Member

:)

@luigimassa
Copy link

Hi,
I've the same problem.
I override the model and setting configuration http://docs.sylius.org/en/latest/bundles/general/overriding_models.html

but when I execute doctr:schema:update --force
there is a doctrine exception : The table with name 'sylius_dev.sylius_user' already exists

I do add only 1 field in user model class.

My entity

  <entity   name="MyBundle\CoreBundle\Entity\User" table="sylius_user">

      <field name="codice_fiscale" length="16" nullable="true" />

  </entity>

???
Thanks in advance

@Richtermeister
Copy link
Contributor

You also have to customize the user class in the sylius_installer settings. See here: #711

@pjedrzejewski Could you take a look at my ticket there? I really think there is a merge-bug in the resources bundle.

@luigimassa
Copy link

thanks for the reply,
I was doing debugging and I saw that the model had not the flag "isMappedSuperClass"

change 3 times the model is not very practical

grazie comunque 👍

pamil pushed a commit to pamil/Sylius that referenced this issue Mar 21, 2016
[Order] Documentation of Order component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Issues needing help and clarification.
Projects
None yet
Development

No branches or pull requests

4 participants