Is there a way to achieve the polymorphic relationships that Laravel has on doctrine?
Here is an example:
class Address
{
protected $street;
...
public function setStreet()
{
}
public function getStreet()
{
}
}
class Event
{
protected $addresses;
...
}
class Museum
{
protected $addresses;
...
}
And in the database it will be something like this:
Address:
id | type (event or museum) | type_id | street ...
Event:
id | name ...
Museum:
id | name ...
I looked at unidirectional inheritance and seemed to solve the problem, but I didn't understand how to associate an event or museum with an address. If someone could have ELI5, I would be very grateful.
source
share