External mapped superclass (inheritance)

0 votes
asked Nov 11, 2014 in Solved by iavansis.miguel (320 points)

Hi,

I'm trying to create an "User" entity that extends "FOS\UserBundle\Entity\User". I got two problems:
- There is no option to specify an external mapped superclass (not defined in the skipper model).
- I can't use the same entity name twice (even if they are on different bundles/namespaces).

Anyone have this issue too? Any workarounds?

Thanks!

1 Answer

0 votes
answered Nov 11, 2014 by ludek.vodicka Skipper developer (140,450 points)
selected Nov 12, 2014 by iavansis.miguel
 
Best answer

Unfortunately both of actions you need aren't possible right now. Currently each entity in Skipper has to have a unique name (we have it in our todo list to change this) and all entities have to be available in model.

commented Nov 11, 2014 by iavansis.miguel (320 points)

Thanks Ludek,

As workaround, I can include all FOSUserBundle entities in my Skipper model ¿can I mark this bundle as not exportable or something like?

commented Nov 11, 2014 by ludek.vodicka Skipper developer (140,450 points)

You can include any model you need in your project. Currently it's not possible to mark any module as read-only, but you can simply remove "Data Format" and "Relative export path" settings and model will not be exported:

enter image description here

commented Nov 11, 2014 by iavansis.miguel (320 points)

Thanks!

I'll try with this workaround.

commented Nov 12, 2014 by iavansis.miguel (320 points)

The trick works,
I've followed these steps:

  • Create a bundle named "FOSUserBundle"
  • Set the bundle namespace to "FOS\"
  • Set the bundle export data format to "" (avoids export)
  • Create an entity named "UserBundle\Entity\User" without any fields. (avoids entity name conflict in Skipper)
  • Create an entity "User" that inherits from "UserBundle\Entity\User"

Thanks!

commented Nov 12, 2014 by ludek.vodicka Skipper developer (140,450 points)

I'm glad you have found a solution! Thanks for sharing the guide.

...