[DB] Add support for calling methods with FQCN

This commit is contained in:
Hugo Sales 2020-09-04 15:15:03 +01:00 committed by Hugo Sales
parent 4328a11eb1
commit ea4f2c522b
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 3 additions and 2 deletions

View File

@ -107,8 +107,9 @@ abstract class DB
public static function __callStatic(string $name, array $args)
{
foreach (['find', 'getReference', 'getPartialReference', 'getRepository'] as $m) {
if ($name == $m) {
$args[0] = '\App\Entity\\' . ucfirst(Formatting::snakeCaseToCamelCase($args[0]));
$pref = '\App\Entity\\';
if ($name == $m && Formatting::startsWith($name, $pref) === false) {
$args[0] = $pref . ucfirst(Formatting::snakeCaseToCamelCase($args[0]));
}
}