Earl
Well-known member
You can extend a class and override its methods by having the same name then call it's parent method with this line
but how do you override a property?
I have this code
well, clearly it overrides $allowedRelations, but I just want to add new element
How do you do it?
return parent:methodName();
but how do you override a property?
I have this code
PHP:
namespace Earl\AddOn\XF\Searcher;
class User extends XFCP_User
{
protected $allowedRelations = ['Option', 'Profile', 'Privacy', 'Custom'];
}
well, clearly it overrides $allowedRelations, but I just want to add new element
Custom
to the parent property $allowedRelations as opposed to hard coding all elements like that.How do you do it?