Problem/Motivation
If one wants to extend either of the server or index classes, then in typical OO fashion one would like to call the parent class constructor method when creating the new class. However, because the entity class (for the $server or $index property) to be created is hard-coded in these constructors as in the code below
public function __construct(array $values = array()) {
parent::__construct($values, 'search_api_index');
}
one is unable to create an instance of the extended class for the $server or $index property using this approach.
Proposed resolution
Add a parameter to each constructor method for the entity type of the class to create with its default value being the currently hard-coded class name in the body of the constructor.
Remaining tasks
Review and test. No documentation.
User interface changes
None.
API changes
None.
Comments
Comment #1
solotandem commentedAttached patch implements proposed resolution.
Comment #3
drunken monkeyMakes sense, thanks a lot for posting!
I vaguely remember copying this code from fago, but I don't think there was really any reason.
So, committed. Thanks again!