[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 f4e52f5e11
commit 29f30a6932

View File

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