Assuming we have two classes, in the \Base\Form\
namespace:
class Field {
protected $name;
protected $value;
}
class DropdownField extends Field {
protected $options = [];
// with functions like setOptions(), addOption(), removeOption() etc.
}
Now, in another namespace, a class exists that extends on Field
, that has an additional 'layout_position'
property:
namespace Integrations;
class IntegrationsField extends \Base\Form\Field {
const LAYOUT_POSITION_LEFT = 'left';
const LAYOUT_POSITION_RIGHT = 'right';
protected $layoutPosition = self::LAYOUT_POSITION_LEFT;
}
Now, you might see this one coming, but in the event of an IntegrationsField
that can also be a dropdown:
namespace Integrations;
class IntegrationsDropdownField extends \Base\Form\DropdownField {}
Of course, this one should also have the $layoutPosition
, that should be inherited from IntegrationsField
, but since we can't extend two classes, what is the best solution to go for here?