[Solved] Index creation with inheritance

+2 votes
asked Dec 17, 2014 in Solved by Schnaaf (400 points)
recategorized Jun 1, 2018 by ludek.vodicka

I'm missing the option to select fields from the base entity when defining an index on the derived entity. For performance reasons we need to define an index that is composed of fields from both the base and the derived entity.

commented Dec 17, 2014 by ludek.vodicka Skipper developer (140,450 points)

Thanks for posting. As we discussed on the chat, we will try to find a way how to implement it.

commented May 21, 2016 by alexndlm (400 points)

Hello. What is the situation with the development of this feature?

commented May 21, 2016 by ludek.vodicka Skipper developer (140,450 points)

Unfortunately this feature requires a lot of changes in the app core. Currently each entity is handled independently and because of that it's not easy to choose fields from different entity.

We have it in our todo list but I can't promise any term right now.

commented May 21, 2016 by alexndlm (400 points)

Thank you, the problem is clear.
Please tell me, how to make so that the indices that have been added manually, not overwritten?

commented May 22, 2016 by ludek.vodicka Skipper developer (140,450 points)

Unfortunately currently isn't an easy way how to do that. Skipper always updates all ORM definitions to current project state so any manual change will be overwritten.

Also it's not possible to exclude one file from whole export because of problem with model consistency.

commented May 23, 2016 by alexndlm (400 points)

Can you add custom index definition property?

commented May 23, 2016 by ludek.vodicka Skipper developer (140,450 points)

How such custom index property should work? Is it only a workaround to this feature or is it some Doctrine feature?

commented May 23, 2016 by alexndlm (400 points)

Same as column-definition property of field. It is only a workaround.

2 Answers

+1 vote
answered Jun 1, 2018 by ludek.vodicka Skipper developer (140,450 points)
 
Best answer

This feature is now implemented in latest beta.

Feel free to check it here: https://support.skipper18.com/402/downloads-skipper-beta

commented Jun 1, 2018 by Schnaaf (400 points)

Thanks for fixing1!

commented Jun 1, 2018 by ludek.vodicka Skipper developer (140,450 points)

You're welcome. If you find some time please test it and let me know if everything works as expected. Thanks!

0 votes
answered Mar 21, 2015 by Stephen (160 points)

I am adding my support to this request for having the ability to include inherited fields to indexes. I can currently do it manually by manually adding a line to the Entity class, e.g.

@ORM\Table(name="table_name")
@ORM\Table(indexes={@ORM\Index(name="index_name", columns={"field_a","field_b"})})

But the line that defines the index gets overwritten the next time I export from Skipper, so this is not a nice solution.

commented Mar 21, 2015 by ludek.vodicka Skipper developer (140,450 points)

You're right. This is currently the only way. We have a plans to add support for this feature in the future. The same behavior will be required by traits which we want to support too.

Currently we're working on namespace support and after that we want to take a look at inheritance+traits.

commented Jun 22, 2016 by jwagner (3,630 points)

What is the status of this feature? I am stumbling upon this now as well, since we want to derive a class from the Gedmo Loggable AbstractLogEntry class but also set indexes.

commented Jun 22, 2016 by ludek.vodicka Skipper developer (140,450 points)

Hi Joern, it's on top of our todo list but it's not ready yet. Unfortunately it's not as easy what it might look.

...