naming fix

This commit is contained in:
yuri
2019-01-25 13:53:57 +02:00
parent 828440785e
commit 6bb717d8a9
14 changed files with 70 additions and 71 deletions

View File

@@ -36,15 +36,17 @@ use \Espo\ORM\Entity;
class Base implements Injectable
{
protected $dependencies = array(
protected $dependencyList = [
'config',
'entityManager',
'aclManager'
);
'aclManager',
];
protected $dependencies = []; // for backward compatibility
protected $scope;
protected $injections = array();
protected $injections = [];
protected $ownerUserIdAttribute = null;
@@ -79,12 +81,12 @@ class Base implements Injectable
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
public function getDependencyList()
{
return $this->dependencies;
return array_merge($this->dependencyList, $this->dependencies);
}
protected function getConfig()

View File

@@ -41,9 +41,9 @@ class AclManager
private $metadata;
private $implementationHashMap = array();
private $implementationHashMap = [];
private $tableHashMap = array();
private $tableHashMap = [];
protected $tableClassName = '\\Espo\\Core\\Acl\\Table';
@@ -93,8 +93,8 @@ class AclManager
if (class_exists($className)) {
$acl = new $className($scope);
$dependencies = $acl->getDependencyList();
foreach ($dependencies as $name) {
$dependencyList = $acl->getDependencyList();
foreach ($dependencyList as $name) {
$acl->inject($name, $this->getContainer()->get($name));
}
$this->implementationHashMap[$scope] = $acl;

View File

@@ -37,7 +37,7 @@ class HookManager
private $data;
private $hookListHash = array();
private $hookListHash = [];
private $hooks;
@@ -48,18 +48,17 @@ class HookManager
*
* @var array
*/
protected $ignoredMethodList = array(
protected $ignoredMethodList = [
'__construct',
'getDependencyList',
'inject'
);
'inject',
];
protected $paths = array(
protected $paths = [
'corePath' => 'application/Espo/Hooks',
'modulePath' => 'application/Espo/Modules/{*}/Hooks',
'customPath' => 'custom/Espo/Custom/Hooks',
);
];
public function __construct(Container $container)
{
@@ -125,8 +124,8 @@ class HookManager
{
if (class_exists($className)) {
$hook = new $className();
$dependencies = $hook->getDependencyList();
foreach ($dependencies as $name) {
$dependencyList = $hook->getDependencyList();
foreach ($dependencyList as $name) {
$hook->inject($name, $this->container->get($name));
}
return $hook;

View File

@@ -33,18 +33,20 @@ use Espo\Core\Interfaces\Injectable;
abstract class Base implements Injectable
{
protected $dependencies = array(
protected $injections = [];
public static $order = 9;
protected $dependencyList = [
'container',
'entityManager',
'config',
'metadata',
'aclManager',
'user',
);
];
protected $injections = array();
public static $order = 9;
protected $dependencies = []; // for backward compatibility
public function __construct()
{
@@ -57,7 +59,7 @@ abstract class Base implements Injectable
public function getDependencyList()
{
return $this->dependencies;
return array_merge($this->dependencyList, $this->dependencies);
}
protected function addDependencyList(array $list)
@@ -69,7 +71,7 @@ abstract class Base implements Injectable
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
protected function getInjection($name)
@@ -116,10 +118,4 @@ abstract class Base implements Injectable
{
return $this->getInjection('metadata');
}
protected function getRepository()
{
return $this->getEntityManager()->getRepository($this->entityName);
}
}

View File

@@ -35,12 +35,12 @@ use \Espo\ORM\Entity;
class Base implements Injectable
{
protected $dependencies = array(
protected $dependencyList = [
'user',
'entityManager',
);
];
protected $injections = array();
protected $injections = [];
public static $order = 9;
@@ -62,12 +62,12 @@ class Base implements Injectable
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
public function getDependencyList()
{
return $this->dependencies;
return $this->dependencyList;
}
protected function getInjection($name)
@@ -82,12 +82,12 @@ class Base implements Injectable
protected function getEntityManager()
{
return $this->injections['entityManager'];
return $this->getInjection('entityManager');
}
protected function getUser()
{
return $this->injections['user'];
return $this->getInjection('user');
}
public function process(Entity $entity, array $options = [])

View File

@@ -39,13 +39,15 @@ use \Espo\Core\Interfaces\Injectable;
class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
{
protected $dependencies = array(
protected $dependencyList = [
'metadata',
'config',
'fieldManagerUtil'
);
];
protected $injections = array();
protected $dependencies = []; // for backward compatibility
protected $injections = [];
private $restoreData = null;
@@ -59,7 +61,7 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
protected function addDependencyList(array $list)
@@ -81,7 +83,7 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable
public function getDependencyList()
{
return $this->dependencies;
return array_merge($this->dependencyList, $this->dependencies);
}
protected function getMetadata()

View File

@@ -35,9 +35,11 @@ use \Espo\ORM\EntityFactory;
abstract class Repository extends \Espo\ORM\Repository implements Injectable
{
protected $dependencies = array();
protected $dependencyList = [];
protected $injections = array();
protected $dependencies = []; // for backward compatibility
protected $injections = [];
protected function init()
{
@@ -55,7 +57,7 @@ abstract class Repository extends \Espo\ORM\Repository implements Injectable
public function getDependencyList()
{
return $this->dependencies;
return array_merge($this->dependencyList, $this->dependencies);
}
protected function addDependencyList(array $list)
@@ -67,7 +69,7 @@ abstract class Repository extends \Espo\ORM\Repository implements Injectable
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
public function __construct($entityType, EntityManager $entityManager, EntityFactory $entityFactory)
@@ -76,4 +78,3 @@ abstract class Repository extends \Espo\ORM\Repository implements Injectable
$this->init();
}
}

View File

@@ -37,11 +37,10 @@ class RepositoryFactory extends \Espo\ORM\RepositoryFactory
{
$repository = parent::create($name);
$dependencies = $repository->getDependencyList();
foreach ($dependencies as $name) {
$dependencyList = $repository->getDependencyList();
foreach ($dependencyList as $name) {
$repository->inject($name, $this->entityManager->getContainer()->get($name));
}
return $repository;
}
}

View File

@@ -63,8 +63,8 @@ class AclManager extends \Espo\Core\AclManager
if (class_exists($className)) {
$acl = new $className($scope);
$dependencies = $acl->getDependencyList();
foreach ($dependencies as $name) {
$dependencyList = $acl->getDependencyList();
foreach ($dependencyList as $name) {
$acl->inject($name, $this->getContainer()->get($name));
}
$this->implementationHashMap[$scope] = $acl;

View File

@@ -41,11 +41,11 @@ class ServiceFactory
/**
* @var array - path to Service files
*/
protected $paths = array(
protected $paths = [
'corePath' => 'application/Espo/Services',
'modulePath' => 'application/Espo/Modules/{*}/Services',
'customPath' => 'custom/Espo/Custom/Services',
);
];
protected $data;
@@ -104,8 +104,8 @@ class ServiceFactory
{
if (class_exists($className)) {
$service = new $className();
$dependencies = $service->getDependencyList();
foreach ($dependencies as $name) {
$dependencyList = $service->getDependencyList();
foreach ($dependencyList as $name) {
$service->inject($name, $this->container->get($name));
}
if (method_exists($service, 'prepare')) {

View File

@@ -33,14 +33,14 @@ use \Espo\Core\Interfaces\Injectable;
abstract class Base implements Injectable
{
protected $dependencies = array(
protected $dependencyList = [
'config',
'entityManager',
'user',
'serviceFactory'
);
'serviceFactory',
];
protected $injections = array();
protected $injections = [];
public function inject($name, $object)
{
@@ -67,7 +67,7 @@ abstract class Base implements Injectable
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
protected function addDependencyList(array $list)
@@ -79,7 +79,7 @@ abstract class Base implements Injectable
public function getDependencyList()
{
return $this->dependencies;
return $this->dependencyList;
}
protected function getEntityManager()

View File

@@ -1,4 +1,4 @@
<?php
<?php
/************************************************************************
* This file is part of EspoCRM.
*
@@ -62,7 +62,7 @@ abstract class Base
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
protected function getInjection($name)

View File

@@ -1,4 +1,4 @@
<?php
<?php
/************************************************************************
* This file is part of EspoCRM.
*
@@ -62,7 +62,7 @@ abstract class Base
protected function addDependency($name)
{
$this->dependencies[] = $name;
$this->dependencyList[] = $name;
}
protected function getInjection($name)
@@ -89,4 +89,4 @@ abstract class Base
{
return $this->getInjection('entityManager');
}
}
}

View File

@@ -42,7 +42,7 @@ use \Espo\Core\Utils\Util;
class Record extends \Espo\Core\Services\Base
{
protected $dependencies = [
protected $dependencyList = [
'entityManager',
'user',
'metadata',
@@ -54,7 +54,7 @@ class Record extends \Espo\Core\Services\Base
'selectManagerFactory',
'fileStorageManager',
'injectableFactory',
'fieldManagerUtil'
'fieldManagerUtil',
];
protected $getEntityBeforeUpdate = false;