orm metadata fields => attributes
This commit is contained in:
@@ -45,7 +45,7 @@ class MetadataDataProvider implements MetadataDataProviderInterface
|
||||
$data = $this->ormMetadataData->getData();
|
||||
|
||||
foreach (array_keys($data) as $entityType) {
|
||||
$data[$entityType]['vFields'] = $this->metadata->get(['entityDefs', $entityType, 'fields']) ?? [];
|
||||
$data[$entityType]['fields'] = $this->metadata->get(['entityDefs', $entityType, 'fields']) ?? [];
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
},
|
||||
"additionalTables": {
|
||||
"{entityType}Path": {
|
||||
"fields": {
|
||||
"attributes": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"dbType": "integer",
|
||||
|
||||
@@ -92,15 +92,8 @@ class Converter
|
||||
/** @var array<string, mixed> */
|
||||
private array $idParams = [];
|
||||
|
||||
/**
|
||||
* Permitted entityDefs parameters which will be copied to ormMetadata.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private array $permittedEntityOptions = [
|
||||
'indexes',
|
||||
'additionalTables',
|
||||
];
|
||||
/** @var string[] */
|
||||
private array $copyEntityProperties = ['indexes'];
|
||||
|
||||
private IndexHelper $indexHelper;
|
||||
|
||||
@@ -167,11 +160,13 @@ class Converter
|
||||
$ormMetadata,
|
||||
$this->createEntityTypesFromRelations($entityType, $entityOrmMetadata)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($entityDefs as $entityMetadata) {
|
||||
/** @var array<string, array<string, mixed>> $ormMetadata */
|
||||
$ormMetadata = Util::merge(
|
||||
$ormMetadata,
|
||||
$this->createAdditionalEntityTypes($entityOrmMetadata)
|
||||
$this->obtainAdditionalTablesOrmMetadata($entityMetadata)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -194,17 +189,17 @@ class Converter
|
||||
$ormMetadata = [];
|
||||
|
||||
$ormMetadata[$entityType] = [
|
||||
'fields' => [],
|
||||
'attributes' => [],
|
||||
'relations' => [],
|
||||
];
|
||||
|
||||
foreach ($this->permittedEntityOptions as $optionName) {
|
||||
foreach ($this->copyEntityProperties as $optionName) {
|
||||
if (isset($entityMetadata[$optionName])) {
|
||||
$ormMetadata[$entityType][$optionName] = $entityMetadata[$optionName];
|
||||
}
|
||||
}
|
||||
|
||||
$ormMetadata[$entityType]['fields'] = $this->convertFields($entityType, $entityMetadata);
|
||||
$ormMetadata[$entityType]['attributes'] = $this->convertFields($entityType, $entityMetadata);
|
||||
|
||||
$ormMetadata = $this->correctFields($entityType, $ormMetadata);
|
||||
|
||||
@@ -224,7 +219,7 @@ class Converter
|
||||
$ormMetadata[$entityType]['collection']['orderBy'] = $collectionDefs['orderByColumn'];
|
||||
}
|
||||
else if (array_key_exists('orderBy', $collectionDefs)) {
|
||||
if (array_key_exists($collectionDefs['orderBy'], $ormMetadata[$entityType]['fields'])) {
|
||||
if (array_key_exists($collectionDefs['orderBy'], $ormMetadata[$entityType]['attributes'])) {
|
||||
$ormMetadata[$entityType]['collection']['orderBy'] = $collectionDefs['orderBy'];
|
||||
}
|
||||
}
|
||||
@@ -245,15 +240,18 @@ class Converter
|
||||
*/
|
||||
private function afterFieldsProcess(array $ormMetadata): array
|
||||
{
|
||||
foreach ($ormMetadata as $entityType => &$entityParams) {
|
||||
foreach ($entityParams['fields'] as $attribute => &$attributeParams) {
|
||||
foreach ($ormMetadata as /*$entityType =>*/ &$entityParams) {
|
||||
if (empty($entityParams['attributes'])) {
|
||||
print_r($entityParams);
|
||||
}
|
||||
foreach ($entityParams['attributes'] as $attribute => &$attributeParams) {
|
||||
|
||||
// Remove fields without type.
|
||||
if (
|
||||
!isset($attributeParams['type']) &&
|
||||
(!isset($attributeParams['notStorable']) || $attributeParams['notStorable'] === false)
|
||||
) {
|
||||
unset($entityParams['fields'][$attribute]);
|
||||
unset($entityParams['attributes'][$attribute]);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -316,7 +314,7 @@ class Converter
|
||||
private function afterProcess(array $ormMetadata): array
|
||||
{
|
||||
foreach ($ormMetadata as $entityType => &$entityParams) {
|
||||
foreach ($entityParams['fields'] as $attribute => &$attributeParams) {
|
||||
foreach ($entityParams['attributes'] as $attribute => &$attributeParams) {
|
||||
$attributeType = $attributeParams['type'] ?? null;
|
||||
|
||||
switch ($attributeType) {
|
||||
@@ -337,7 +335,7 @@ class Converter
|
||||
*/
|
||||
private function obtainForeignType(array $data, string $entityType, string $attribute): ?string
|
||||
{
|
||||
$params = $data[$entityType]['fields'][$attribute] ?? [];
|
||||
$params = $data[$entityType]['attributes'][$attribute] ?? [];
|
||||
|
||||
$foreign = $params['foreign'] ?? null;
|
||||
$relation = $params['relation'] ?? null;
|
||||
@@ -354,7 +352,7 @@ class Converter
|
||||
return null;
|
||||
}
|
||||
|
||||
$foreignParams = $data[$foreignEntityType]['fields'][$foreign] ?? [];
|
||||
$foreignParams = $data[$foreignEntityType]['attributes'][$foreign] ?? [];
|
||||
|
||||
return $foreignParams['type'] ?? null;
|
||||
}
|
||||
@@ -397,7 +395,7 @@ class Converter
|
||||
|
||||
$fieldTypeMetadata = $this->metadataHelper->getFieldDefsByType($attributeParams);
|
||||
|
||||
$fieldDefs = $this->convertField($entityType, $attribute, $attributeParams, $fieldTypeMetadata);
|
||||
$fieldDefs = $this->convertField($attributeParams, $fieldTypeMetadata);
|
||||
|
||||
if ($fieldDefs !== false) {
|
||||
if (isset($output[$attribute]) && !in_array($attribute, $unmergedFields)) {
|
||||
@@ -442,23 +440,23 @@ class Converter
|
||||
{
|
||||
$entityMetadata = $ormMetadata[$entityType];
|
||||
|
||||
foreach ($entityMetadata['fields'] as $field => $fieldParams) {
|
||||
$fieldType = $fieldParams['type'] ?? null;
|
||||
foreach ($entityMetadata['attributes'] as $field => $itemParams) {
|
||||
$type = $itemParams['type'] ?? null;
|
||||
|
||||
if (!$fieldType) {
|
||||
if (!$type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var ?class-string<FieldConverter> $className */
|
||||
$className = $this->metadata->get(['fields', $fieldType, 'converterClassName']);
|
||||
$className = $this->metadata->get(['fields', $type, 'converterClassName']);
|
||||
|
||||
if ($className) {
|
||||
$toUnset =
|
||||
!in_array('', $this->metadata->get(['fields', $fieldType, 'actualFields']) ?? []) &&
|
||||
!in_array('', $this->metadata->get(['fields', $fieldType, 'notActualFields']) ?? []);
|
||||
!in_array('', $this->metadata->get(['fields', $type, 'actualFields']) ?? []) &&
|
||||
!in_array('', $this->metadata->get(['fields', $type, 'notActualFields']) ?? []);
|
||||
|
||||
if ($toUnset) {
|
||||
$ormMetadata = Util::unsetInArray($ormMetadata, [$entityType => ['fields.' . $field]]);
|
||||
$ormMetadata = Util::unsetInArray($ormMetadata, [$entityType => ['attributes.' . $field]]);
|
||||
}
|
||||
|
||||
$converter = $this->injectableFactory->create($className);
|
||||
@@ -480,7 +478,7 @@ class Converter
|
||||
if ($defaultAttributes && array_key_exists($field, $defaultAttributes)) {
|
||||
$defaultMetadataPart = [
|
||||
$entityType => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
$field => [
|
||||
'default' => $defaultAttributes[$field],
|
||||
]
|
||||
@@ -499,19 +497,19 @@ class Converter
|
||||
|
||||
if ($scopeDefs['stream'] ?? false) {
|
||||
if (!isset($entityMetadata['fields']['isFollowed'])) {
|
||||
$ormMetadata[$entityType]['fields']['isFollowed'] = [
|
||||
$ormMetadata[$entityType]['attributes']['isFollowed'] = [
|
||||
'type' => Entity::VARCHAR,
|
||||
'notStorable' => true,
|
||||
'notExportable' => true,
|
||||
];
|
||||
|
||||
$ormMetadata[$entityType]['fields']['followersIds'] = [
|
||||
$ormMetadata[$entityType]['attributes']['followersIds'] = [
|
||||
'type' => Entity::JSON_ARRAY,
|
||||
'notStorable' => true,
|
||||
'notExportable' => true,
|
||||
];
|
||||
|
||||
$ormMetadata[$entityType]['fields']['followersNames'] = [
|
||||
$ormMetadata[$entityType]['attributes']['followersNames'] = [
|
||||
'type' => Entity::JSON_OBJECT,
|
||||
'notStorable' => true,
|
||||
'notExportable' => true,
|
||||
@@ -521,7 +519,7 @@ class Converter
|
||||
|
||||
// @todo Refactor.
|
||||
if ($this->metadata->get(['entityDefs', $entityType, 'optimisticConcurrencyControl'])) {
|
||||
$ormMetadata[$entityType]['fields']['versionNumber'] = [
|
||||
$ormMetadata[$entityType]['attributes']['versionNumber'] = [
|
||||
'type' => Entity::INT,
|
||||
'dbType' => Types::BIGINT,
|
||||
'notExportable' => true,
|
||||
@@ -537,8 +535,6 @@ class Converter
|
||||
* @return array<string, mixed>|false
|
||||
*/
|
||||
private function convertField(
|
||||
string $entityType,
|
||||
string $field,
|
||||
array $fieldParams,
|
||||
?array $fieldTypeMetadata = null
|
||||
) {
|
||||
@@ -742,8 +738,8 @@ class Converter
|
||||
|
||||
$defs['indexes'] ??= [];
|
||||
|
||||
if (isset($defs['fields'])) {
|
||||
$indexList = self::getEntityIndexListFromAttributes($defs['fields']);
|
||||
if (isset($defs['attributes'])) {
|
||||
$indexList = self::getEntityIndexListFromAttributes($defs['attributes']);
|
||||
|
||||
foreach ($indexList as $indexName => $indexParams) {
|
||||
if (!isset($defs['indexes'][$indexName])) {
|
||||
@@ -824,7 +820,7 @@ class Converter
|
||||
* @param array<string, mixed> $defs
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function createAdditionalEntityTypes(array $defs): array
|
||||
private function obtainAdditionalTablesOrmMetadata(array $defs): array
|
||||
{
|
||||
/** @var array<string, array<string, mixed>> $additionalDefs */
|
||||
$additionalDefs = $defs['additionalTables'] ?? [];
|
||||
@@ -840,6 +836,17 @@ class Converter
|
||||
$this->applyIndexes($additionalDefs, $itemEntityType);
|
||||
}
|
||||
|
||||
// For backward compatibility. Actual as of v8.0.
|
||||
// @todo Remove in v10.0.
|
||||
// @todo Add deprecation warning in v9.0. If 'fields' is set.
|
||||
foreach ($additionalDefs as &$entityDefs) {
|
||||
if (!isset($entityDefs['attributes'])) {
|
||||
$entityDefs['attributes'] = $entityDefs['fields'] ?? [];
|
||||
|
||||
unset($entityDefs['fields']);
|
||||
}
|
||||
}
|
||||
|
||||
return $additionalDefs;
|
||||
}
|
||||
|
||||
@@ -862,7 +869,7 @@ class Converter
|
||||
|
||||
$itemDefs = [
|
||||
'skipRebuild' => true,
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
'autoincrement' => true,
|
||||
@@ -876,7 +883,7 @@ class Converter
|
||||
|
||||
if (!$relationDefs->hasMidKey()) {
|
||||
throw new LogicException(
|
||||
"Bad manyMany relation {$name} in {$entityType}. Might be not defined on the other side.");
|
||||
"Bad manyMany relation $name in $entityType. Might be not defined on the other side.");
|
||||
}
|
||||
|
||||
$key1 = $relationDefs->getMidKey();
|
||||
@@ -885,7 +892,7 @@ class Converter
|
||||
$midKeys = [$key1, $key2];
|
||||
|
||||
foreach ($midKeys as $key) {
|
||||
$itemDefs['fields'][$key] = [
|
||||
$itemDefs['attributes'][$key] = [
|
||||
'type' => Entity::FOREIGN_ID,
|
||||
];
|
||||
}
|
||||
@@ -907,7 +914,7 @@ class Converter
|
||||
$columnDefs['default'] = $attributeDefs->getParam('default');
|
||||
}
|
||||
|
||||
$itemDefs['fields'][$columnName] = $columnDefs;
|
||||
$itemDefs['attributes'][$columnName] = $columnDefs;
|
||||
}
|
||||
|
||||
foreach ($relationDefs->getIndexList() as $indexDefs) {
|
||||
|
||||
@@ -125,8 +125,7 @@ class EntityDefs
|
||||
$attributesData[$name] = $attributeDefs->toAssoc();
|
||||
}
|
||||
|
||||
// @todo Change to attributes.
|
||||
$data['fields'] = $attributesData;
|
||||
$data['attributes'] = $attributesData;
|
||||
}
|
||||
|
||||
if (count($this->relations)) {
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
},
|
||||
"additionalTables": {
|
||||
"DocumentFolderPath": {
|
||||
"fields": {
|
||||
"attributes": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"dbType": "integer",
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@
|
||||
},
|
||||
"additionalTables": {
|
||||
"KnowledgeBaseCategoryPath": {
|
||||
"fields": {
|
||||
"attributes": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"dbType": "integer",
|
||||
|
||||
@@ -85,7 +85,7 @@ class BaseEntity implements Entity
|
||||
$this->entityType = $entityType;
|
||||
$this->entityManager = $entityManager;
|
||||
|
||||
$this->attributes = $defs['attributes'] ?? $defs['fields'] ?? $this->attributes;
|
||||
$this->attributes = $defs['attributes'] /*?? $defs['fields']*/ ?? $this->attributes;
|
||||
$this->relations = $defs['relations'] ?? $this->relations;
|
||||
|
||||
if ($valueAccessorFactory) {
|
||||
|
||||
@@ -76,7 +76,7 @@ class EntityDefs
|
||||
public function getAttributeNameList(): array
|
||||
{
|
||||
/** @var string[] */
|
||||
return array_keys($this->data['attributes'] ?? $this->data['fields'] ?? []);
|
||||
return array_keys($this->data['attributes']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ class EntityDefs
|
||||
public function getFieldNameList(): array
|
||||
{
|
||||
/** @var string[] */
|
||||
return array_keys($this->data['vFields'] ?? []);
|
||||
return array_keys($this->data['fields'] ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,7 +419,7 @@ class EntityDefs
|
||||
|
||||
private function loadField(string $name): ?FieldDefs
|
||||
{
|
||||
$raw = $this->data['vFields'][$name] ?? /*$this->data['fields'][$name] ??*/ null;
|
||||
$raw = $this->data['fields'][$name] ?? null;
|
||||
|
||||
if (!$raw) {
|
||||
return null;
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
},
|
||||
"additionalTables": {
|
||||
"EmailTemplateCategoryPath": {
|
||||
"fields": {
|
||||
"attributes": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"dbType": "integer",
|
||||
|
||||
@@ -45,7 +45,7 @@ class FiltersMatcherTest extends \PHPUnit\Framework\TestCase
|
||||
$this->entityManager = $this->createMock(EntityManager::class);
|
||||
|
||||
$this->emailDefs = [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'from' => [
|
||||
'type' => 'varchar'
|
||||
],
|
||||
@@ -68,7 +68,7 @@ class FiltersMatcherTest extends \PHPUnit\Framework\TestCase
|
||||
];
|
||||
|
||||
$this->filterDefs = [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'from' => [
|
||||
'type' => 'varchar'
|
||||
],
|
||||
|
||||
@@ -55,7 +55,7 @@ class EntityDefsTest extends TestCase
|
||||
->withIndex($i1);
|
||||
|
||||
$this->assertEquals([
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'a1' => $a1->toAssoc(),
|
||||
'a2' => $a2->toAssoc(),
|
||||
],
|
||||
|
||||
@@ -39,387 +39,387 @@ class EmailTest extends \PHPUnit\Framework\TestCase
|
||||
private $email;
|
||||
|
||||
// TODO defs test helper
|
||||
protected $defs = array(
|
||||
'fields' =>
|
||||
array (
|
||||
protected $defs = [
|
||||
'attributes' =>
|
||||
[
|
||||
'id' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'id',
|
||||
'dbType' => 'varchar',
|
||||
'len' => '24',
|
||||
),
|
||||
],
|
||||
'name' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'subject' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'fromName' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'from' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'to' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'cc' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'bcc' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'replyTo' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'emailAddress' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'base',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'bodyPlain' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'text',
|
||||
),
|
||||
],
|
||||
'body' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'text',
|
||||
),
|
||||
],
|
||||
'isHtml' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'bool',
|
||||
'default' => true,
|
||||
),
|
||||
],
|
||||
'status' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'default' => 'Archived',
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'parent' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'linkParent',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'dateSent' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'datetime',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'createdAt' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'datetime',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'modifiedAt' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'datetime',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'deleted' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
),
|
||||
],
|
||||
'bccEmailAddressesIds' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'bccEmailAddressesNames' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'ccEmailAddressesIds' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'ccEmailAddressesNames' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'toEmailAddressesIds' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'toEmailAddressesNames' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'fromEmailAddressName' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreign',
|
||||
'relation' => 'fromEmailAddress',
|
||||
'foreign' => 'name',
|
||||
),
|
||||
],
|
||||
'fromEmailAddressId' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreignId',
|
||||
'index' => true,
|
||||
'dbType' => 'varchar',
|
||||
'len' => '24',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'attachmentsIds' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'attachmentsNames' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'assignedUserName' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreign',
|
||||
'relation' => 'assignedUser',
|
||||
'foreign' =>
|
||||
array (
|
||||
[
|
||||
0 => 'firstName',
|
||||
1 => ' ',
|
||||
2 => 'lastName',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
'assignedUserId' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreignId',
|
||||
'index' => true,
|
||||
'dbType' => 'varchar',
|
||||
'len' => '24',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'modifiedByName' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreign',
|
||||
'relation' => 'modifiedBy',
|
||||
'foreign' =>
|
||||
array (
|
||||
[
|
||||
0 => 'firstName',
|
||||
1 => ' ',
|
||||
2 => 'lastName',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
'modifiedById' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreignId',
|
||||
'index' => true,
|
||||
'dbType' => 'varchar',
|
||||
'len' => '24',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'createdByName' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreign',
|
||||
'relation' => 'createdBy',
|
||||
'foreign' =>
|
||||
array (
|
||||
[
|
||||
0 => 'firstName',
|
||||
1 => ' ',
|
||||
2 => 'lastName',
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
'createdById' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreignId',
|
||||
'index' => true,
|
||||
'dbType' => 'varchar',
|
||||
'len' => '24',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'parentId' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreignId',
|
||||
'index' => 'parent',
|
||||
'dbType' => 'varchar',
|
||||
'len' => '24',
|
||||
'notNull' => false,
|
||||
),
|
||||
],
|
||||
'parentType' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'foreignType',
|
||||
'notNull' => false,
|
||||
'index' => 'parent',
|
||||
'dbType' => 'varchar',
|
||||
'len' => 255,
|
||||
),
|
||||
],
|
||||
'parentName' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'teamsIds' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
],
|
||||
'teamsNames' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
'relations' =>
|
||||
array (
|
||||
[
|
||||
'bccEmailAddresses' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'manyMany',
|
||||
'entity' => 'EmailAddress',
|
||||
'foreignKey' => 'id',
|
||||
'midKeys' =>
|
||||
array (
|
||||
[
|
||||
0 => 'emailId',
|
||||
1 => 'emailAddressId',
|
||||
),
|
||||
],
|
||||
'relationName' => 'EmailEmailAddress',
|
||||
'conditions' =>
|
||||
array (
|
||||
[
|
||||
'addressType' => 'bcc',
|
||||
),
|
||||
],
|
||||
'additionalColumns' =>
|
||||
array (
|
||||
[
|
||||
'addressType' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => '4',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
'ccEmailAddresses' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'manyMany',
|
||||
'entity' => 'EmailAddress',
|
||||
'foreignKey' => 'id',
|
||||
'midKeys' =>
|
||||
array (
|
||||
[
|
||||
0 => 'emailId',
|
||||
1 => 'emailAddressId',
|
||||
),
|
||||
],
|
||||
'relationName' => 'EmailEmailAddress',
|
||||
'conditions' =>
|
||||
array (
|
||||
[
|
||||
'addressType' => 'cc',
|
||||
),
|
||||
],
|
||||
'additionalColumns' =>
|
||||
array (
|
||||
[
|
||||
'addressType' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => '4',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
'toEmailAddresses' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'manyMany',
|
||||
'entity' => 'EmailAddress',
|
||||
'foreignKey' => 'id',
|
||||
'midKeys' =>
|
||||
array (
|
||||
[
|
||||
0 => 'emailId',
|
||||
1 => 'emailAddressId',
|
||||
),
|
||||
],
|
||||
'relationName' => 'EmailEmailAddress',
|
||||
'conditions' =>
|
||||
array (
|
||||
[
|
||||
'addressType' => 'to',
|
||||
),
|
||||
],
|
||||
'additionalColumns' =>
|
||||
array (
|
||||
[
|
||||
'addressType' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => '4',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
'fromEmailAddress' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'belongsTo',
|
||||
'entity' => 'EmailAddress',
|
||||
'key' => 'fromEmailAddressId',
|
||||
'foreignKey' => 'id',
|
||||
),
|
||||
],
|
||||
'attachments' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'hasChildren',
|
||||
'entity' => 'Attachment',
|
||||
'foreignKey' => 'parentId',
|
||||
'foreignType' => 'parentType',
|
||||
),
|
||||
],
|
||||
'teams' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'manyMany',
|
||||
'entity' => 'Team',
|
||||
'relationName' => 'entityTeam',
|
||||
'midKeys' =>
|
||||
array (
|
||||
[
|
||||
0 => 'entity_id',
|
||||
1 => 'team_id',
|
||||
),
|
||||
],
|
||||
'conditions' =>
|
||||
array (
|
||||
[
|
||||
'entityType' => 'Email',
|
||||
),
|
||||
],
|
||||
'additionalColumns' =>
|
||||
array (
|
||||
[
|
||||
'entityType' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
],
|
||||
'assignedUser' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'belongsTo',
|
||||
'entity' => 'User',
|
||||
'key' => 'assignedUserId',
|
||||
'foreignKey' => 'id',
|
||||
),
|
||||
],
|
||||
'modifiedBy' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'belongsTo',
|
||||
'entity' => 'User',
|
||||
'key' => 'modifiedById',
|
||||
'foreignKey' => 'id',
|
||||
),
|
||||
],
|
||||
'createdBy' =>
|
||||
array (
|
||||
[
|
||||
'type' => 'belongsTo',
|
||||
'entity' => 'User',
|
||||
'key' => 'createdById',
|
||||
'foreignKey' => 'id',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
protected function setUp() : void
|
||||
|
||||
@@ -199,7 +199,7 @@ class DefsTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$data = [
|
||||
'Test' => [
|
||||
'fields' => [],
|
||||
'attributes' => [],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -252,7 +252,7 @@ class DefsTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$data = [
|
||||
'Test' => [
|
||||
'fields' => [],
|
||||
'attributes' => [],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -269,7 +269,7 @@ class DefsTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$data = [
|
||||
'Test' => [
|
||||
'vFields' => [
|
||||
'fields' => [
|
||||
'f1' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
@@ -302,7 +302,7 @@ class DefsTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$data = [
|
||||
'Test' => [
|
||||
'fields' => [],
|
||||
'attributes' => [],
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -1,138 +1,138 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'fields' => array(
|
||||
'id' =>
|
||||
array (
|
||||
return [
|
||||
'attributes' => [
|
||||
'id' =>
|
||||
[
|
||||
'dbType' => 'varchar',
|
||||
'len' => 24,
|
||||
'type' => 'id',
|
||||
),
|
||||
'name' =>
|
||||
array (
|
||||
],
|
||||
'name' =>
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => 255,
|
||||
),
|
||||
'deleted' =>
|
||||
array (
|
||||
],
|
||||
'deleted' =>
|
||||
[
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
),
|
||||
'type' =>
|
||||
array (
|
||||
],
|
||||
'type' =>
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => 100,
|
||||
),
|
||||
'size' =>
|
||||
array (
|
||||
],
|
||||
'size' =>
|
||||
[
|
||||
'type' => 'int',
|
||||
'len' => 11,
|
||||
),
|
||||
'sourceId' =>
|
||||
array (
|
||||
],
|
||||
'sourceId' =>
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => 36,
|
||||
),
|
||||
'createdAt' =>
|
||||
array (
|
||||
],
|
||||
'createdAt' =>
|
||||
[
|
||||
'type' => 'datetime',
|
||||
'notNull' => false,
|
||||
),
|
||||
'contents' =>
|
||||
array (
|
||||
],
|
||||
'contents' =>
|
||||
[
|
||||
'type' => 'text',
|
||||
'notStorable' => true,
|
||||
),
|
||||
'role' =>
|
||||
array (
|
||||
],
|
||||
'role' =>
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'len' => 36,
|
||||
),
|
||||
'global' =>
|
||||
array (
|
||||
],
|
||||
'global' =>
|
||||
[
|
||||
'type' => 'bool',
|
||||
'default' => false,
|
||||
),
|
||||
'parentId' =>
|
||||
array (
|
||||
],
|
||||
'parentId' =>
|
||||
[
|
||||
'dbType' => 'varchar',
|
||||
'len' => 24,
|
||||
'type' => 'foreignId',
|
||||
'index' => 'parent',
|
||||
'notNull' => false,
|
||||
),
|
||||
'parentType' =>
|
||||
array (
|
||||
],
|
||||
'parentType' =>
|
||||
[
|
||||
'type' => 'foreignType',
|
||||
'notNull' => false,
|
||||
'index' => 'parent',
|
||||
'len' => 100,
|
||||
'dbType' => 'varchar',
|
||||
),
|
||||
'parentName' =>
|
||||
array (
|
||||
],
|
||||
'parentName' =>
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
'relatedId' =>
|
||||
array (
|
||||
],
|
||||
'relatedId' =>
|
||||
[
|
||||
'dbType' => 'varchar',
|
||||
'len' => 24,
|
||||
'type' => 'foreignId',
|
||||
'index' => 'related',
|
||||
'notNull' => false,
|
||||
),
|
||||
'relatedType' =>
|
||||
array (
|
||||
],
|
||||
'relatedType' =>
|
||||
[
|
||||
'type' => 'foreignType',
|
||||
'notNull' => false,
|
||||
'index' => 'related',
|
||||
'len' => 100,
|
||||
'dbType' => 'varchar',
|
||||
),
|
||||
'relatedName' =>
|
||||
array (
|
||||
],
|
||||
'relatedName' =>
|
||||
[
|
||||
'type' => 'varchar',
|
||||
'notStorable' => true,
|
||||
),
|
||||
'createdById' =>
|
||||
array (
|
||||
],
|
||||
'createdById' =>
|
||||
[
|
||||
'dbType' => 'varchar',
|
||||
'len' => 24,
|
||||
'type' => 'foreignId',
|
||||
'index' => true,
|
||||
'notNull' => false,
|
||||
),
|
||||
'createdByName' =>
|
||||
array (
|
||||
],
|
||||
'createdByName' =>
|
||||
[
|
||||
'type' => 'foreign',
|
||||
'notStorable' => false,
|
||||
'relation' => 'createdBy',
|
||||
'foreign' =>
|
||||
array (
|
||||
'foreign' =>
|
||||
[
|
||||
0 => 'firstName',
|
||||
1 => ' ',
|
||||
2 => 'lastName',
|
||||
),
|
||||
),
|
||||
),
|
||||
'relations' => array(
|
||||
'related' =>
|
||||
array (
|
||||
],
|
||||
],
|
||||
],
|
||||
'relations' => [
|
||||
'related' =>
|
||||
[
|
||||
'type' => 'belongsToParent',
|
||||
'key' => 'relatedId',
|
||||
),
|
||||
'parent' =>
|
||||
array (
|
||||
],
|
||||
'parent' =>
|
||||
[
|
||||
'type' => 'belongsToParent',
|
||||
'key' => 'parentId',
|
||||
),
|
||||
'createdBy' =>
|
||||
array (
|
||||
],
|
||||
'createdBy' =>
|
||||
[
|
||||
'type' => 'belongsTo',
|
||||
'entity' => 'User',
|
||||
'key' => 'createdById',
|
||||
'foreignKey' => 'id',
|
||||
),
|
||||
)
|
||||
);
|
||||
],
|
||||
]
|
||||
];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ use Espo\ORM\Entity;
|
||||
|
||||
return [
|
||||
'Account' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -41,7 +41,7 @@ return [
|
||||
],
|
||||
|
||||
'Team' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -60,7 +60,7 @@ return [
|
||||
],
|
||||
|
||||
'EntityTeam' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
'autoincrement' => true,
|
||||
@@ -89,7 +89,7 @@ return [
|
||||
],
|
||||
|
||||
'Contact' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -120,7 +120,7 @@ return [
|
||||
],
|
||||
|
||||
'Post' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -195,7 +195,7 @@ return [
|
||||
],
|
||||
|
||||
'Comment' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -227,7 +227,7 @@ return [
|
||||
],
|
||||
|
||||
'PostData' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -251,7 +251,7 @@ return [
|
||||
],
|
||||
|
||||
'Tag' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -281,7 +281,7 @@ return [
|
||||
],
|
||||
|
||||
'PostTag' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
'autoincrement' => true,
|
||||
@@ -316,7 +316,7 @@ return [
|
||||
],
|
||||
|
||||
'Note' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -349,7 +349,7 @@ return [
|
||||
],
|
||||
|
||||
'Article' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID
|
||||
],
|
||||
@@ -371,7 +371,7 @@ return [
|
||||
],
|
||||
|
||||
'Job' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID
|
||||
],
|
||||
@@ -400,7 +400,7 @@ return [
|
||||
],
|
||||
|
||||
'Test' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -437,7 +437,7 @@ return [
|
||||
],
|
||||
|
||||
'Dependee' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -459,7 +459,7 @@ return [
|
||||
],
|
||||
|
||||
'TestWhere' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -521,7 +521,7 @@ return [
|
||||
],
|
||||
|
||||
'TestSelect' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
@@ -558,7 +558,7 @@ return [
|
||||
],
|
||||
|
||||
'TestSelectRight' => [
|
||||
'fields' => [
|
||||
'attributes' => [
|
||||
'id' => [
|
||||
'type' => Entity::ID,
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user