This commit is contained in:
Yuri Kuznetsov
2021-10-29 12:46:57 +03:00
parent d899c55f4f
commit 8286d7b621
25 changed files with 85 additions and 48 deletions
@@ -607,9 +607,11 @@ abstract class Base
}
/**
* Get needed file list based on type. E.g. file list for "beforeCopy" action
* @param string $type
* @return boolean
* Get needed file list based on type. E.g. file list for "beforeCopy" action.
*
* @param string $type
*
* @return string|null
*/
protected function getCopyFilesPath($type = null)
{
@@ -645,6 +647,8 @@ abstract class Base
return $filesPath;
}
}
return null;
}
protected function getVendorFileList($type = 'copy')
@@ -138,9 +138,7 @@ class Install extends \Espo\Core\Upgrades\Actions\Base\Install
}
/**
* Create a record of Extension Entity
*
* @return bool
* Create a record of Extension Entity.
*/
protected function storeExtension()
{
+3 -1
View File
@@ -35,9 +35,11 @@ abstract class Base
{
private $container;
protected $actionManager;
protected $name = null;
protected $params = array();
protected $params = [];
const UPLOAD = 'upload';
@@ -43,6 +43,8 @@ class Converter
private $config;
private $ormConverter;
public function __construct(Metadata $metadata, FileManager $fileManager, Config $config = null)
{
$this->metadata = $metadata;
@@ -67,4 +69,4 @@ class Converter
return $data;
}
}
}
@@ -29,12 +29,11 @@
namespace Espo\Core\Utils\Database\DBAL\Traits\Platforms;
use Doctrine\DBAL\Types\BlobType;
use Doctrine\DBAL\Types\TextType;
use Doctrine\DBAL\Schema\{
TableDiff,
Index,
Table,
Constraint,
ForeignKeyConstraint,
ColumnDiff,
Column,
Identifier,
@@ -32,18 +32,19 @@ namespace Espo\Core\Utils\Database\Orm\Fields;
class Base extends \Espo\Core\Utils\Database\Orm\Base
{
/**
* Start process Orm converting for fields
* Start process Orm converting for fields.
*
* @param string $itemName Field name
* @param string $entityName
* @param string $itemName Field name
* @param string $entityName
* @return array
*/
public function process($itemName, $entityName)
{
$inputs = array(
$inputs = [
'itemName' => $itemName,
'entityName' => $entityName,
);
];
$this->setMethods($inputs);
$convertedDefs = $this->load($itemName, $entityName);
@@ -53,4 +54,9 @@ class Base extends \Espo\Core\Utils\Database\Orm\Base
return $convertedDefs;
}
}
protected function load($fieldName, $entityType)
{
}
}
@@ -171,4 +171,8 @@ class Base extends \Espo\Core\Utils\Database\Orm\Base
return $additionalParam;
}
protected function load($linkName, $entityType)
{
}
}
@@ -78,6 +78,8 @@ class Schema
private $rebuildActionsPath = 'Core/Utils/Database/Schema/rebuildActions';
private $schemaConverter;
/**
* Array of rebuildActions classes in format:
* [
+22 -16
View File
@@ -28,6 +28,7 @@
************************************************************************/
namespace Espo\Core\Utils\Metadata;
use Espo\Core\Utils\Util;
class Helper
@@ -37,7 +38,7 @@ class Helper
protected $defaultNaming = 'postfix';
/**
* List of copied params for metadata -> 'fields' from parent items
* List of copied params for metadata -> 'fields' from parent items.
*/
protected $copiedDefParams = array(
'readOnly',
@@ -65,10 +66,10 @@ class Helper
}
/**
* Get field definition by type in metadata, "fields" key
* Get field definition by type in metadata, "fields" key.
*
* @param array | string $fieldDef - It can be a string or field definition from entityDefs
* @return array | null
* @param array|string $fieldDef - It can be a string or field definition from entityDefs
* @return array|null
*/
public function getFieldDefsByType($fieldDef)
{
@@ -86,6 +87,7 @@ class Helper
public function getFieldDefsInFieldMeta($fieldDef)
{
$fieldDefsByType = $this->getFieldDefsByType($fieldDef);
if (isset($fieldDefsByType['fieldDefs'])) {
return $fieldDefsByType['fieldDefs'];
}
@@ -94,20 +96,24 @@ class Helper
}
/**
* Get link definition defined in 'fields' metadata. In linkDefs can be used as value (e.g. "type": "hasChildren") and/or variables (e.g. "entityName":"{entity}"). Variables should be defined into fieldDefs (in 'entityDefs' metadata).
* Get link definition defined in 'fields' metadata.
* In linkDefs can be used as value (e.g. "type": "hasChildren") and/or variables (e.g. "entityName":"{entity}").
* Variables should be defined into fieldDefs (in 'entityDefs' metadata).
*
* @param string $entityName
* @param array $fieldDef
* @param array $linkFieldDefsByType
* @return array | null
* @param string $entityName
* @param array $fieldDef
* @param array $linkFieldDefsByType
* @return array|null
*/
public function getLinkDefsInFieldMeta($entityName, $fieldDef, array $linkFieldDefsByType = null)
{
if (!isset($fieldDefsByType)) {
$fieldDefsByType = $this->getFieldDefsByType($fieldDef);
if (!isset($fieldDefsByType['linkDefs'])) {
return null;
}
$linkFieldDefsByType = $fieldDefsByType['linkDefs'];
}
@@ -129,18 +135,18 @@ class Helper
}
/**
* Get additional field list based on field definition in metadata 'fields'
* Get additional field list based on field definition in metadata 'fields'.
*
* @param string $fieldName
* @param array $fieldParams
* @param array|null $definitionList
* @param string $fieldName
* @param array $fieldParams
* @param array|null $definitionList
*
* @return array
* @return array|null
*/
public function getAdditionalFieldList($fieldName, array $fieldParams, array $definitionList)
{
if (empty($fieldParams['type']) || empty($definitionList)) {
return;
return null;
}
$fieldType = $fieldParams['type'];
@@ -163,6 +169,6 @@ class Helper
return $additionalFields;
}
return null;
}
}
@@ -54,6 +54,8 @@ class OrmMetadataData
protected $config;
private $converter;
public function __construct(
Metadata $metadata,
FileManager $fileManager,
+4 -4
View File
@@ -31,7 +31,7 @@ namespace Espo\Entities;
use Espo\Core\ORM\Entity;
use StdClass;
use stdClass;
class Integration extends Entity
{
@@ -52,7 +52,7 @@ class Integration extends Entity
$data = $this->get('data');
}
else {
$data = new StdClass();
$data = new stdClass();
}
if (isset($data->$name)) {
@@ -70,7 +70,7 @@ class Integration extends Entity
$data = $this->get('data');
if (empty($data)) {
$data = new StdClass();
$data = new stdClass();
}
unset($data->$name);
@@ -177,7 +177,7 @@ class Integration extends Entity
);
}
public function getValueMap(): StdClass
public function getValueMap(): stdClass
{
$arr = $this->toArray();
@@ -52,8 +52,6 @@ class LogoImage extends Image implements Di\ConfigAware
$id = $request->get('id');
$size = $request->get('size') ?? null;
$this->imageSizes['small-logo'] = [181, 44];
if (!$id) {
$id = $this->config->get('companyLogoId');
}
-1
View File
@@ -100,7 +100,6 @@ class BaseEntity implements Entity
$this->entityType = $entityType ?? null;
$this->entityManager = $entityManager;
$this->valueAccessorFactory = $valueAccessorFactory;
$this->attributes = $defs['attributes'] ?? $defs['fields'] ?? $this->attributes;
$this->relations = $defs['relations'] ?? $this->relations;
+2
View File
@@ -86,6 +86,8 @@ class EntityManager
private $queryExecutor;
private $queryBuilder;
private $sqlExecutor;
private $transactionManager;
@@ -71,10 +71,14 @@ class BaseMapper implements RDBMapper
protected $queryComposer;
protected $entityFactory;
protected $metadata;
protected $sqlExecutor;
protected $helper;
public function __construct(
PDO $pdo,
EntityFactory $entityFactory,
+1 -1
View File
@@ -56,7 +56,7 @@ class InsertBuilder implements Builder
*/
public function clone(Insert $query): self
{
$this->cloneInternal($query);
return $this->cloneInternal($query);
}
/**
@@ -127,7 +127,7 @@ class Condition
*/
public static function notLike(Expression $subject, $pattern): Comparison
{
return Comparison::notLike($arg1, $pattern);
return Comparison::notLike($subject, $pattern);
}
/**
@@ -39,6 +39,8 @@ class OrderList implements Iterator
{
private $position = 0;
private $list;
private function __construct(array $list)
{
foreach ($list as $item) {
@@ -30,6 +30,7 @@
"medium": [256, 256],
"large": [512, 512],
"x-large": [864, 864],
"xx-large": [1024, 1024]
"xx-large": [1024, 1024],
"small-logo": [181, 44]
}
}
+1 -1
View File
@@ -301,7 +301,7 @@ class Attachment extends Record
public function getAttachmentFromImageUrl($data)
{
$attachment = $this->getEntity();
$attachment = $this->getRepository()->getNew();
if (empty($data->url)) {
throw new BadRequest();
+3 -1
View File
@@ -53,6 +53,8 @@ use Espo\Tools\{
Export\Params as ExportParams,
};
use stdClass;
class Record extends RecordService implements
Di\AclManagerAware,
@@ -348,7 +350,7 @@ class Record extends RecordService implements
Entity $entity,
string $targetCurrency,
string $baseCurrency,
StdClass $rates,
stdClass $rates,
bool $allFields = false,
?array $fieldList = null
) {
@@ -63,6 +63,8 @@ class AssignmentProcessor
private $metadata;
private $language;
private $log;
public function __construct(
@@ -87,6 +87,8 @@ class Processor
private $metadata;
private $language;
private $log;
private $noteAccessControl;
+1 -1
View File
@@ -285,7 +285,7 @@ class Export
}
if (!is_string($foreign)) {
return self::VARCHAR;
return Entity::VARCHAR;
}
if (!$entityDefs->getRelation($relation)->hasForeignEntityType()) {
@@ -64,7 +64,7 @@ class ContentsString implements Contents
public static function createFromString(string $contents): ContentsString
{
$obj = new $obj($contents);
$obj = new self($contents);
return $obj;
}