I have the following script:
<?php
class A {
protected static $aliases = [];
public static function doSomething()
{
foreach (self::$aliases as $column => $alias) {
// do something
echo "$column: $alias" . PHP_EOL;
}
}
}
class B extends A {
protected static $aliases = [
'id' => 'real_id',
'name' => 'real_name',
];
}
$obj = B::doSomething(); // does nothing
How could I make B inherit the function but use it's own parameters? I have attempted to create a getInstance
type function, however I don't think I understood the concept correctly and didn't work. I have since moved this function into a trait -- it still seems to give the same result.
Any and all assistance is appreciated.