mirror of
https://github.com/Karaka-Management/oms-SupplierManagement.git
synced 2026-01-11 17:28:41 +00:00
new datamapper mostly implemented
This commit is contained in:
parent
9a7fe5a5e8
commit
960c5219bf
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\SupplierManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Supplier mapper class.
|
||||
|
|
@ -24,7 +24,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class SupplierAttributeMapper extends DataMapperAbstract
|
||||
final class SupplierAttributeMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
|
|
@ -32,7 +32,7 @@ final class SupplierAttributeMapper extends DataMapperAbstract
|
|||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
public const COLUMNS = [
|
||||
'suppliermgmt_supplier_attr_id' => ['name' => 'suppliermgmt_supplier_attr_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'suppliermgmt_supplier_attr_supplier' => ['name' => 'suppliermgmt_supplier_attr_supplier', 'type' => 'int', 'internal' => 'supplier'],
|
||||
'suppliermgmt_supplier_attr_type' => ['name' => 'suppliermgmt_supplier_attr_type', 'type' => 'int', 'internal' => 'type'],
|
||||
|
|
@ -45,7 +45,7 @@ final class SupplierAttributeMapper extends DataMapperAbstract
|
|||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $ownsOne = [
|
||||
public const OWNS_ONE = [
|
||||
'type' => [
|
||||
'mapper' => SupplierAttributeTypeMapper::class,
|
||||
'external' => 'suppliermgmt_supplier_attr_type',
|
||||
|
|
@ -62,7 +62,7 @@ final class SupplierAttributeMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'suppliermgmt_supplier_attr';
|
||||
public const TABLE = 'suppliermgmt_supplier_attr';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
|
|
@ -70,5 +70,5 @@ final class SupplierAttributeMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'suppliermgmt_supplier_attr_id';
|
||||
public const PRIMARYFIELD ='suppliermgmt_supplier_attr_id';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\SupplierManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Supplier mapper class.
|
||||
|
|
@ -24,7 +24,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class SupplierAttributeTypeL11nMapper extends DataMapperAbstract
|
||||
final class SupplierAttributeTypeL11nMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
|
|
@ -32,7 +32,7 @@ final class SupplierAttributeTypeL11nMapper extends DataMapperAbstract
|
|||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
public const COLUMNS = [
|
||||
'suppliermgmt_attr_type_l11n_id' => ['name' => 'suppliermgmt_attr_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'suppliermgmt_attr_type_l11n_title' => ['name' => 'suppliermgmt_attr_type_l11n_title', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
|
||||
'suppliermgmt_attr_type_l11n_type' => ['name' => 'suppliermgmt_attr_type_l11n_type', 'type' => 'int', 'internal' => 'type'],
|
||||
|
|
@ -45,7 +45,7 @@ final class SupplierAttributeTypeL11nMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'suppliermgmt_attr_type_l11n';
|
||||
public const TABLE = 'suppliermgmt_attr_type_l11n';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
|
|
@ -53,5 +53,5 @@ final class SupplierAttributeTypeL11nMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'suppliermgmt_attr_type_l11n_id';
|
||||
public const PRIMARYFIELD ='suppliermgmt_attr_type_l11n_id';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\SupplierManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Supplier mapper class.
|
||||
|
|
@ -24,7 +24,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class SupplierAttributeTypeMapper extends DataMapperAbstract
|
||||
final class SupplierAttributeTypeMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
|
|
@ -32,7 +32,7 @@ final class SupplierAttributeTypeMapper extends DataMapperAbstract
|
|||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
public const COLUMNS = [
|
||||
'suppliermgmt_attr_type_id' => ['name' => 'suppliermgmt_attr_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'suppliermgmt_attr_type_name' => ['name' => 'suppliermgmt_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
||||
'suppliermgmt_attr_type_fields' => ['name' => 'suppliermgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
||||
|
|
@ -47,21 +47,19 @@ final class SupplierAttributeTypeMapper extends DataMapperAbstract
|
|||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $hasMany = [
|
||||
public const HAS_MANY = [
|
||||
'l11n' => [
|
||||
'mapper' => SupplierAttributeTypeL11nMapper::class,
|
||||
'table' => 'suppliermgmt_attr_type_l11n',
|
||||
'self' => 'suppliermgmt_attr_type_l11n_type',
|
||||
'column' => 'title',
|
||||
'conditional' => true,
|
||||
'external' => null,
|
||||
],
|
||||
'defaults' => [
|
||||
'mapper' => SupplierAttributeValueMapper::class,
|
||||
'table' => 'suppliermgmt_supplier_attr_default',
|
||||
'self' => 'suppliermgmt_supplier_attr_default_type',
|
||||
'external' => 'suppliermgmt_supplier_attr_default_value',
|
||||
'conditional' => false,
|
||||
'external' => 'suppliermgmt_supplier_attr_default_value'
|
||||
],
|
||||
];
|
||||
|
||||
|
|
@ -71,7 +69,7 @@ final class SupplierAttributeTypeMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'suppliermgmt_attr_type';
|
||||
public const TABLE = 'suppliermgmt_attr_type';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
|
|
@ -79,5 +77,5 @@ final class SupplierAttributeTypeMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'suppliermgmt_attr_type_id';
|
||||
public const PRIMARYFIELD ='suppliermgmt_attr_type_id';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\SupplierManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Supplier mapper class.
|
||||
|
|
@ -24,7 +24,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|||
* @link https: //orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class SupplierAttributeValueMapper extends DataMapperAbstract
|
||||
final class SupplierAttributeValueMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
|
|
@ -32,7 +32,7 @@ final class SupplierAttributeValueMapper extends DataMapperAbstract
|
|||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
public const COLUMNS = [
|
||||
'suppliermgmt_attr_value_id' => ['name' => 'suppliermgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'suppliermgmt_attr_value_default' => ['name' => 'suppliermgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
|
||||
'suppliermgmt_attr_value_type' => ['name' => 'suppliermgmt_attr_value_type', 'type' => 'int', 'internal' => 'type'],
|
||||
|
|
@ -50,7 +50,7 @@ final class SupplierAttributeValueMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'suppliermgmt_attr_value';
|
||||
public const TABLE = 'suppliermgmt_attr_value';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
|
|
@ -58,5 +58,5 @@ final class SupplierAttributeValueMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'suppliermgmt_attr_value_id';
|
||||
public const PRIMARYFIELD ='suppliermgmt_attr_value_id';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ use Modules\Editor\Models\EditorDocMapper;
|
|||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Profile\Models\ContactElementMapper;
|
||||
use Modules\Profile\Models\ProfileMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Supplier mapper class.
|
||||
|
|
@ -29,7 +29,7 @@ use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class SupplierMapper extends DataMapperAbstract
|
||||
final class SupplierMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
|
|
@ -37,7 +37,7 @@ final class SupplierMapper extends DataMapperAbstract
|
|||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
public const COLUMNS = [
|
||||
'suppliermgmt_supplier_id' => ['name' => 'suppliermgmt_supplier_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'suppliermgmt_supplier_no' => ['name' => 'suppliermgmt_supplier_no', 'type' => 'string', 'internal' => 'number'],
|
||||
'suppliermgmt_supplier_no_reverse' => ['name' => 'suppliermgmt_supplier_no_reverse', 'type' => 'string', 'internal' => 'numberReverse'],
|
||||
|
|
@ -55,7 +55,7 @@ final class SupplierMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'suppliermgmt_supplier';
|
||||
public const TABLE = 'suppliermgmt_supplier';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
|
|
@ -63,7 +63,7 @@ final class SupplierMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'suppliermgmt_supplier_id';
|
||||
public const PRIMARYFIELD ='suppliermgmt_supplier_id';
|
||||
|
||||
/**
|
||||
* Created at column
|
||||
|
|
@ -71,7 +71,7 @@ final class SupplierMapper extends DataMapperAbstract
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $createdAt = 'suppliermgmt_supplier_created_at';
|
||||
public const CREATED_AT = 'suppliermgmt_supplier_created_at';
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
|
|
@ -79,7 +79,7 @@ final class SupplierMapper extends DataMapperAbstract
|
|||
* @var array<string, array{mapper:string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $ownsOne = [
|
||||
public const OWNS_ONE = [
|
||||
'profile' => [
|
||||
'mapper' => ProfileMapper::class,
|
||||
'external' => 'suppliermgmt_supplier_profile',
|
||||
|
|
@ -96,7 +96,7 @@ final class SupplierMapper extends DataMapperAbstract
|
|||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $hasMany = [
|
||||
public const HAS_MANY = [
|
||||
'files' => [
|
||||
'mapper' => MediaMapper::class, /* mapper of the related object */
|
||||
'table' => 'suppliermgmt_supplier_media', /* table of the related object, null if no relation table is used (many->1) */
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ require_once __DIR__ . '/../vendor/autoload.php';
|
|||
require_once __DIR__ . '/Autoloader.php';
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\DataStorage\Session\HttpSession;
|
||||
|
||||
$CONFIG = [
|
||||
|
|
@ -329,7 +329,7 @@ $GLOBALS['dbpool']->create('delete', $CONFIG['db']['core']['masters']['delete'])
|
|||
$GLOBALS['dbpool']->create('insert', $CONFIG['db']['core']['masters']['insert']);
|
||||
$GLOBALS['dbpool']->create('schema', $CONFIG['db']['core']['masters']['schema']);
|
||||
|
||||
DataMapperAbstract::setConnection($GLOBALS['dbpool']->get());
|
||||
DataMapperFactory::db($GLOBALS['dbpool']->get());
|
||||
|
||||
$GLOBALS['frameworkpath'] = '/phpOMS/';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user