bug fixes / dbmapper fixes

This commit is contained in:
Dennis Eichhorn 2021-12-19 20:20:39 +01:00
parent ef303e2eda
commit 6c54a30d8a
11 changed files with 76 additions and 78 deletions

View File

@ -62,8 +62,6 @@ class AccountRelation
/** /**
* Constructor. * Constructor.
* *
* @param string $name Event name/title
*
* @since 1.0.0 * @since 1.0.0
*/ */
public function __construct() public function __construct()

View File

@ -34,9 +34,9 @@ final class AccountRelationMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'marketing_promotion_accountrel_id' => ['name' => 'marketing_promotion_accountrel_id', 'type' => 'int', 'internal' => 'id'], 'marketing_promotion_accountrel_id' => ['name' => 'marketing_promotion_accountrel_id', 'type' => 'int', 'internal' => 'id'],
'marketing_promotion_accountrel_promotion' => ['name' => 'marketing_promotion_accountrel_promotion', 'type' => 'int', 'internal' => 'promotion'], 'marketing_promotion_accountrel_promotion' => ['name' => 'marketing_promotion_accountrel_promotion', 'type' => 'int', 'internal' => 'promotion'],
'marketing_promotion_accountrel_type' => ['name' => 'marketing_promotion_accountrel_type', 'type' => 'int', 'internal' => 'type'], 'marketing_promotion_accountrel_type' => ['name' => 'marketing_promotion_accountrel_type', 'type' => 'int', 'internal' => 'type'],
]; ];
/** /**
@ -47,8 +47,8 @@ final class AccountRelationMapper extends DataMapperFactory
*/ */
public const OWNS_ONE = [ public const OWNS_ONE = [
'account' => [ 'account' => [
'mapper' => AccountMapper::class, 'mapper' => AccountMapper::class,
'external' => 'marketing_promotion_accountrel_account', 'external' => 'marketing_promotion_accountrel_account',
], ],
]; ];

View File

@ -184,15 +184,15 @@ class Promotion
*/ */
public function __construct(string $name = '') public function __construct(string $name = '')
{ {
$this->start = new \DateTime('now'); $this->start = new \DateTime('now');
$this->end = (new \DateTime('now'))->modify('+1 month'); $this->end = (new \DateTime('now'))->modify('+1 month');
$this->calendar = new Calendar(); $this->calendar = new Calendar();
$this->actualCosts = new Money(); $this->actualCosts = new Money();
$this->actualEarnings = new Money(); $this->actualEarnings = new Money();
$this->budgetCosts = new Money(); $this->budgetCosts = new Money();
$this->budgetEarnings = new Money(); $this->budgetEarnings = new Money();
$this->createdAt = new \DateTimeImmutable('now'); $this->createdAt = new \DateTimeImmutable('now');
$this->createdBy = new NullAccount(); $this->createdBy = new NullAccount();
$this->name = $name; $this->name = $name;
} }

View File

@ -87,10 +87,10 @@ class PromotionAttribute implements \JsonSerializable, ArrayableInterface
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'item' => $this->item, 'promotion' => $this->promotion,
'type' => $this->type, 'type' => $this->type,
'value' => $this->value, 'value' => $this->value,
]; ];
} }

View File

@ -33,10 +33,10 @@ final class PromotionAttributeMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'marketing_promotion_attr_id' => ['name' => 'marketing_promotion_attr_id', 'type' => 'int', 'internal' => 'id'], 'marketing_promotion_attr_id' => ['name' => 'marketing_promotion_attr_id', 'type' => 'int', 'internal' => 'id'],
'marketing_promotion_attr_promotion' => ['name' => 'marketing_promotion_attr_promotion', 'type' => 'int', 'internal' => 'promotion'], 'marketing_promotion_attr_promotion' => ['name' => 'marketing_promotion_attr_promotion', 'type' => 'int', 'internal' => 'promotion'],
'marketing_promotion_attr_type' => ['name' => 'marketing_promotion_attr_type', 'type' => 'int', 'internal' => 'type'], 'marketing_promotion_attr_type' => ['name' => 'marketing_promotion_attr_type', 'type' => 'int', 'internal' => 'type'],
'marketing_promotion_attr_value' => ['name' => 'marketing_promotion_attr_value', 'type' => 'int', 'internal' => 'value'], 'marketing_promotion_attr_value' => ['name' => 'marketing_promotion_attr_value', 'type' => 'int', 'internal' => 'value'],
]; ];
/** /**
@ -47,12 +47,12 @@ final class PromotionAttributeMapper extends DataMapperFactory
*/ */
public const OWNS_ONE = [ public const OWNS_ONE = [
'type' => [ 'type' => [
'mapper' => PromotionAttributeTypeMapper::class, 'mapper' => PromotionAttributeTypeMapper::class,
'external' => 'marketing_promotion_attr_type', 'external' => 'marketing_promotion_attr_type',
], ],
'value' => [ 'value' => [
'mapper' => PromotionAttributeValueMapper::class, 'mapper' => PromotionAttributeValueMapper::class,
'external' => 'marketing_promotion_attr_value', 'external' => 'marketing_promotion_attr_value',
], ],
]; ];

View File

@ -105,7 +105,7 @@ class PromotionAttributeType implements \JsonSerializable, ArrayableInterface
* Set l11n * Set l11n
* *
* @param string|PromotionAttributeTypeL11n $l11n Tag article l11n * @param string|PromotionAttributeTypeL11n $l11n Tag article l11n
* @param string $lang Language * @param string $lang Language
* *
* @return void * @return void
* *

View File

@ -63,8 +63,8 @@ class PromotionAttributeTypeL11n implements \JsonSerializable, ArrayableInterfac
* Constructor. * Constructor.
* *
* @param int|PromotionAttributeType $type Attribute type * @param int|PromotionAttributeType $type Attribute type
* @param string $title Localized title * @param string $title Localized title
* @param string $language Language * @param string $language Language
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -33,10 +33,10 @@ final class PromotionAttributeTypeL11nMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'marketing_promotion_attr_type_l11n_id' => ['name' => 'marketing_promotion_attr_type_l11n_id', 'type' => 'int', 'internal' => 'id'], 'marketing_promotion_attr_type_l11n_id' => ['name' => 'marketing_promotion_attr_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'marketing_promotion_attr_type_l11n_title' => ['name' => 'marketing_promotion_attr_type_l11n_title', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true], 'marketing_promotion_attr_type_l11n_title' => ['name' => 'marketing_promotion_attr_type_l11n_title', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
'marketing_promotion_attr_type_l11n_type' => ['name' => 'marketing_promotion_attr_type_l11n_type', 'type' => 'int', 'internal' => 'type'], 'marketing_promotion_attr_type_l11n_type' => ['name' => 'marketing_promotion_attr_type_l11n_type', 'type' => 'int', 'internal' => 'type'],
'marketing_promotion_attr_type_l11n_lang' => ['name' => 'marketing_promotion_attr_type_l11n_lang', 'type' => 'string', 'internal' => 'language'], 'marketing_promotion_attr_type_l11n_lang' => ['name' => 'marketing_promotion_attr_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
]; ];
/** /**

View File

@ -33,12 +33,12 @@ final class PromotionAttributeTypeMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'marketing_promotion_attr_type_id' => ['name' => 'marketing_promotion_attr_type_id', 'type' => 'int', 'internal' => 'id'], 'marketing_promotion_attr_type_id' => ['name' => 'marketing_promotion_attr_type_id', 'type' => 'int', 'internal' => 'id'],
'marketing_promotion_attr_type_name' => ['name' => 'marketing_promotion_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true], 'marketing_promotion_attr_type_name' => ['name' => 'marketing_promotion_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'marketing_promotion_attr_type_fields' => ['name' => 'marketing_promotion_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'marketing_promotion_attr_type_fields' => ['name' => 'marketing_promotion_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
'marketing_promotion_attr_type_custom' => ['name' => 'marketing_promotion_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], 'marketing_promotion_attr_type_custom' => ['name' => 'marketing_promotion_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'marketing_promotion_attr_type_pattern' => ['name' => 'marketing_promotion_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'marketing_promotion_attr_type_pattern' => ['name' => 'marketing_promotion_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
'marketing_promotion_attr_type_required' => ['name' => 'marketing_promotion_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'], 'marketing_promotion_attr_type_required' => ['name' => 'marketing_promotion_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
]; ];
/** /**
@ -49,17 +49,17 @@ final class PromotionAttributeTypeMapper extends DataMapperFactory
*/ */
public const HAS_MANY = [ public const HAS_MANY = [
'l11n' => [ 'l11n' => [
'mapper' => PromotionAttributeTypeL11nMapper::class, 'mapper' => PromotionAttributeTypeL11nMapper::class,
'table' => 'marketing_promotion_attr_type_l11n', 'table' => 'marketing_promotion_attr_type_l11n',
'self' => 'marketing_promotion_attr_type_l11n_type', 'self' => 'marketing_promotion_attr_type_l11n_type',
'column' => 'title', 'column' => 'title',
'external' => null, 'external' => null,
], ],
'defaults' => [ 'defaults' => [
'mapper' => PromotionAttributeValueMapper::class, 'mapper' => PromotionAttributeValueMapper::class,
'table' => 'marketing_promotion_attr_default', 'table' => 'marketing_promotion_attr_default',
'self' => 'marketing_promotion_attr_default_type', 'self' => 'marketing_promotion_attr_default_type',
'external' => 'marketing_promotion_attr_default_value' 'external' => 'marketing_promotion_attr_default_value'
], ],
]; ];

View File

@ -8,7 +8,7 @@
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
* @version 1.0.0 * @version 1.0.0
* @link https: //orange-management.org * @link https://orange-management.org
*/ */
declare(strict_types=1); declare(strict_types=1);
@ -21,7 +21,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
* *
* @package Modules\Marketing\Models * @package Modules\Marketing\Models
* @license OMS License 1.0 * @license OMS License 1.0
* @link https: //orange-management.org * @link https://orange-management.org
* @since 1.0.0 * @since 1.0.0
*/ */
final class PromotionAttributeValueMapper extends DataMapperFactory final class PromotionAttributeValueMapper extends DataMapperFactory
@ -33,15 +33,15 @@ final class PromotionAttributeValueMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'marketing_promotion_attr_value_id' => ['name' => 'marketing_promotion_attr_value_id', 'type' => 'int', 'internal' => 'id'], 'marketing_promotion_attr_value_id' => ['name' => 'marketing_promotion_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'marketing_promotion_attr_value_default' => ['name' => 'marketing_promotion_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'], 'marketing_promotion_attr_value_default' => ['name' => 'marketing_promotion_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'marketing_promotion_attr_value_type' => ['name' => 'marketing_promotion_attr_value_type', 'type' => 'int', 'internal' => 'type'], 'marketing_promotion_attr_value_type' => ['name' => 'marketing_promotion_attr_value_type', 'type' => 'int', 'internal' => 'type'],
'marketing_promotion_attr_value_valueStr' => ['name' => 'marketing_promotion_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'], 'marketing_promotion_attr_value_valueStr' => ['name' => 'marketing_promotion_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'marketing_promotion_attr_value_valueInt' => ['name' => 'marketing_promotion_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'], 'marketing_promotion_attr_value_valueInt' => ['name' => 'marketing_promotion_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'marketing_promotion_attr_value_valueDec' => ['name' => 'marketing_promotion_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'], 'marketing_promotion_attr_value_valueDec' => ['name' => 'marketing_promotion_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'marketing_promotion_attr_value_valueDat' => ['name' => 'marketing_promotion_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'], 'marketing_promotion_attr_value_valueDat' => ['name' => 'marketing_promotion_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'marketing_promotion_attr_value_lang' => ['name' => 'marketing_promotion_attr_value_lang', 'type' => 'string', 'internal' => 'language'], 'marketing_promotion_attr_value_lang' => ['name' => 'marketing_promotion_attr_value_lang', 'type' => 'string', 'internal' => 'language'],
'marketing_promotion_attr_value_country' => ['name' => 'marketing_promotion_attr_value_country', 'type' => 'string', 'internal' => 'country'], 'marketing_promotion_attr_value_country' => ['name' => 'marketing_promotion_attr_value_country', 'type' => 'string', 'internal' => 'country'],
]; ];
/** /**

View File

@ -37,20 +37,20 @@ final class PromotionMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'marketing_promotion_id' => ['name' => 'marketing_promotion_id', 'type' => 'int', 'internal' => 'id'], 'marketing_promotion_id' => ['name' => 'marketing_promotion_id', 'type' => 'int', 'internal' => 'id'],
'marketing_promotion_name' => ['name' => 'marketing_promotion_name', 'type' => 'string', 'internal' => 'name'], 'marketing_promotion_name' => ['name' => 'marketing_promotion_name', 'type' => 'string', 'internal' => 'name'],
'marketing_promotion_description' => ['name' => 'marketing_promotion_description', 'type' => 'string', 'internal' => 'description'], 'marketing_promotion_description' => ['name' => 'marketing_promotion_description', 'type' => 'string', 'internal' => 'description'],
'marketing_promotion_calendar' => ['name' => 'marketing_promotion_calendar', 'type' => 'int', 'internal' => 'calendar'], 'marketing_promotion_calendar' => ['name' => 'marketing_promotion_calendar', 'type' => 'int', 'internal' => 'calendar'],
'marketing_promotion_budgetcosts' => ['name' => 'marketing_promotion_budgetcosts', 'type' => 'Serializable', 'internal' => 'budgetCosts'], 'marketing_promotion_budgetcosts' => ['name' => 'marketing_promotion_budgetcosts', 'type' => 'Serializable', 'internal' => 'budgetCosts'],
'marketing_promotion_budgetearnings' => ['name' => 'marketing_promotion_budgetearnings', 'type' => 'Serializable', 'internal' => 'budgetEarnings'], 'marketing_promotion_budgetearnings' => ['name' => 'marketing_promotion_budgetearnings', 'type' => 'Serializable', 'internal' => 'budgetEarnings'],
'marketing_promotion_actualcosts' => ['name' => 'marketing_promotion_actualcosts', 'type' => 'Serializable', 'internal' => 'actualCosts'], 'marketing_promotion_actualcosts' => ['name' => 'marketing_promotion_actualcosts', 'type' => 'Serializable', 'internal' => 'actualCosts'],
'marketing_promotion_actualearnings' => ['name' => 'marketing_promotion_actualearnings', 'type' => 'Serializable', 'internal' => 'actualEarnings'], 'marketing_promotion_actualearnings' => ['name' => 'marketing_promotion_actualearnings', 'type' => 'Serializable', 'internal' => 'actualEarnings'],
'marketing_promotion_start' => ['name' => 'marketing_promotion_start', 'type' => 'DateTime', 'internal' => 'start'], 'marketing_promotion_start' => ['name' => 'marketing_promotion_start', 'type' => 'DateTime', 'internal' => 'start'],
'marketing_promotion_end' => ['name' => 'marketing_promotion_end', 'type' => 'DateTime', 'internal' => 'end'], 'marketing_promotion_end' => ['name' => 'marketing_promotion_end', 'type' => 'DateTime', 'internal' => 'end'],
'marketing_promotion_progress' => ['name' => 'marketing_promotion_progress', 'type' => 'int', 'internal' => 'progress'], 'marketing_promotion_progress' => ['name' => 'marketing_promotion_progress', 'type' => 'int', 'internal' => 'progress'],
'marketing_promotion_progress_type' => ['name' => 'marketing_promotion_progress_type', 'type' => 'int', 'internal' => 'progressType'], 'marketing_promotion_progress_type' => ['name' => 'marketing_promotion_progress_type', 'type' => 'int', 'internal' => 'progressType'],
'marketing_promotion_created_by' => ['name' => 'marketing_promotion_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'marketing_promotion_created_by' => ['name' => 'marketing_promotion_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
'marketing_promotion_created_at' => ['name' => 'marketing_promotion_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'marketing_promotion_created_at' => ['name' => 'marketing_promotion_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
]; ];
/** /**
@ -73,10 +73,10 @@ final class PromotionMapper extends DataMapperFactory
'self' => 'marketing_promotion_media_src', 'self' => 'marketing_promotion_media_src',
], ],
'accountRelations' => [ 'accountRelations' => [
'mapper' => AccountRelationMapper::class, 'mapper' => AccountRelationMapper::class,
'table' => 'marketing_promotion_accountrel', 'table' => 'marketing_promotion_accountrel',
'self' => 'marketing_promotion_accountrel_promotion', 'self' => 'marketing_promotion_accountrel_promotion',
'external' => null, 'external' => null,
], ],
'attributes' => [ 'attributes' => [
'mapper' => PromotionAttributeMapper::class, 'mapper' => PromotionAttributeMapper::class,
@ -95,8 +95,8 @@ final class PromotionMapper extends DataMapperFactory
*/ */
public const OWNS_ONE = [ public const OWNS_ONE = [
'calendar' => [ 'calendar' => [
'mapper' => CalendarMapper::class, 'mapper' => CalendarMapper::class,
'external' => 'marketing_promotion_calendar', 'external' => 'marketing_promotion_calendar',
], ],
]; ];
@ -108,8 +108,8 @@ final class PromotionMapper extends DataMapperFactory
*/ */
public const BELONGS_TO = [ public const BELONGS_TO = [
'createdBy' => [ 'createdBy' => [
'mapper' => AccountMapper::class, 'mapper' => AccountMapper::class,
'external' => 'marketing_promotion_created_by', 'external' => 'marketing_promotion_created_by',
], ],
]; ];