mardi 29 septembre 2015

Are polymorphic relationships bad practice?

I'm using Laravel and have run into the need to have something just like polymorphic relationships. It would seem that they solve exactly what I need, which is being able to store different data based on a type, in a nutshell.

However, I'm aware that I would not be able to use any constraints, like foreign keys. And I've read around that they're essentially an anti-pattern. But I was wondering what others think about it, and if anyone is using them without issues.

Otherwise, is there an alternative way I could accomplish what polymorphic relationships provide, without actually using them? (Using Laravel)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire