remove deprecated injectable and base classes

This commit is contained in:
Yuri Kuznetsov
2024-11-09 13:32:41 +02:00
parent 7a09f08484
commit 39f018d99b
13 changed files with 1 additions and 1197 deletions

View File

@@ -34,7 +34,6 @@ use Psr\Container\NotFoundExceptionInterface;
use Espo\Core\Binding\BindingContainer;
use Espo\Core\Binding\Binding;
use Espo\Core\Binding\Factory;
use Espo\Core\Interfaces\Injectable;
use ReflectionClass;
use ReflectionParameter;
@@ -171,13 +170,6 @@ class InjectableFactory
$obj = $class->newInstanceArgs($injectionList);
// @todo Remove in v9.0.
if ($class->implementsInterface(Injectable::class)) {
$this->applyInjectable($class, $obj);
return $obj;
}
$this->applyAwareInjections($class, $obj);
return $obj;
@@ -457,45 +449,4 @@ class InjectableFactory
return false;
}
/**
* @deprecated As of v6.0. Use create or createWith methods instead.
*
* @template T of object
* @param class-string<T> $className
* @param ?array<string, mixed> $with
* @return T
*/
public function createByClassName(string $className, ?array $with = null): object
{
return $this->createInternal($className, $with);
}
/**
* @deprecated
* @param ReflectionClass<object> $class
* @todo Remove in v9.0.
*/
private function applyInjectable(ReflectionClass $class, object $obj): void
{
$setList = [];
assert($obj instanceof Injectable);
$dependencyList = $obj->getDependencyList();
foreach ($dependencyList as $name) {
$injection = $this->container->get($name);
if ($this->classHasDependencySetter($class, $name)) {
$methodName = 'set' . ucfirst($name);
$obj->$methodName($injection);
$setList[] = $name;
}
$obj->inject($name, $injection);
}
$this->applyAwareInjections($class, $obj, $setList);
}
}