repositoryClassName, entityClassName in metadata

This commit is contained in:
Yuri Kuznetsov
2024-03-02 18:42:36 +02:00
parent e96c1deffe
commit 9be5342220
8 changed files with 28 additions and 115 deletions
@@ -86,6 +86,13 @@ class ClassNameProvider
*/
private function findEntityClassName(string $entityType): string
{
/** @var ?class-string<Entity> $className */
$className = $this->metadata->get("entityDefs.$entityType.entityClassName");
if ($className) {
return $className;
}
/** @var ?class-string<Entity> $className */
$className = $this->classFinder->find('Entities', $entityType);
@@ -114,6 +121,13 @@ class ClassNameProvider
*/
private function findRepositoryClassName(string $entityType): string
{
/** @var ?class-string<Repository<Entity>> $className */
$className = $this->metadata->get("entityDefs.$entityType.repositoryClassName");
if ($className) {
return $className;
}
/** @var ?class-string<Repository<Entity>> $className */
$className = $this->classFinder->find('Repositories', $entityType);
@@ -1,37 +0,0 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
namespace Espo\Modules\Crm\Repositories;
/**
* @extends \Espo\Core\Repositories\CategoryTree<\Espo\Modules\Crm\Entities\DocumentFolder>
*/
class DocumentFolder extends \Espo\Core\Repositories\CategoryTree
{
}
@@ -1,37 +0,0 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
namespace Espo\Modules\Crm\Repositories;
/**
* @extends \Espo\Core\Repositories\CategoryTree<\Espo\Modules\Crm\Entities\KnowledgeBaseCategory>
*/
class KnowledgeBaseCategory extends \Espo\Core\Repositories\CategoryTree
{
}
@@ -98,5 +98,6 @@
}
}
}
}
},
"repositoryClassName": "Espo\\Core\\Repositories\\CategoryTree"
}
@@ -105,5 +105,6 @@
}
}
}
}
},
"repositoryClassName": "Espo\\Core\\Repositories\\CategoryTree"
}
@@ -1,38 +0,0 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
namespace Espo\Repositories;
use Espo\Core\Repositories\CategoryTree;
/**
* @extends CategoryTree<\Espo\Entities\EmailTemplateCategory>
*/
class EmailTemplateCategory extends CategoryTree
{}
@@ -94,5 +94,6 @@
}
}
}
}
},
"repositoryClassName": "Espo\\Core\\Repositories\\CategoryTree"
}
+8
View File
@@ -83,6 +83,14 @@
"noDeletedAttribute": {
"type": "boolean",
"description": "Do not add the `deleted` attribute."
},
"entityClassName": {
"type": "string",
"description": "An entity. Should implement Espo\\ORM\\Entity. Usually should extend Espo\\Core\\ORM\\Entity. As of v8.2."
},
"repositoryClassName": {
"type": "string",
"description": "A repository. Should implement Espo\\ORM\\Repository\\Repository. As of v8.2."
}
},
"definitions": {