diff --git a/Admin/Install/db.json b/Admin/Install/db.json index d847eb5..7619e25 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -249,11 +249,6 @@ "type": "TINYINT(1)", "null": false }, - "marketing_promotion_attr_value_type": { - "name": "marketing_promotion_attr_value_type", - "type": "INT(11)", - "null": false - }, "marketing_promotion_attr_value_valueStr": { "name": "marketing_promotion_attr_value_valueStr", "type": "VARCHAR(255)", diff --git a/Models/AccountRelationMapper.php b/Models/AccountRelationMapper.php index da0b10c..5c4cb5a 100755 --- a/Models/AccountRelationMapper.php +++ b/Models/AccountRelationMapper.php @@ -42,7 +42,7 @@ final class AccountRelationMapper extends DataMapperFactory /** * Has one relation. * - * @var array + * @var array * @since 1.0.0 */ public const OWNS_ONE = [ diff --git a/Models/PromotionAttributeMapper.php b/Models/PromotionAttributeMapper.php index 0e1491b..44d6d21 100755 --- a/Models/PromotionAttributeMapper.php +++ b/Models/PromotionAttributeMapper.php @@ -42,7 +42,7 @@ final class PromotionAttributeMapper extends DataMapperFactory /** * Has one relation. * - * @var array + * @var array * @since 1.0.0 */ public const OWNS_ONE = [ diff --git a/Models/PromotionAttributeType.php b/Models/PromotionAttributeType.php index 69a9f02..af52415 100755 --- a/Models/PromotionAttributeType.php +++ b/Models/PromotionAttributeType.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\Marketing\Models; +use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\ISO639x1Enum; /** @@ -65,9 +66,9 @@ class PromotionAttributeType implements \JsonSerializable /** * Localization * - * @var PromotionAttributeTypeL11n + * @var BaseStringL11n */ - private string | PromotionAttributeTypeL11n $l11n; + private string | BaseStringL11n $l11n; /** * Possible default attribute values @@ -103,22 +104,23 @@ class PromotionAttributeType implements \JsonSerializable /** * Set l11n * - * @param string|PromotionAttributeTypeL11n $l11n Tag article l11n - * @param string $lang Language + * @param string|BaseStringL11n $l11n Tag article l11n + * @param string $lang Language * * @return void * * @since 1.0.0 */ - public function setL11n(string | PromotionAttributeTypeL11n $l11n, string $lang = ISO639x1Enum::_EN) : void + public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void { - if ($l11n instanceof PromotionAttributeTypeL11n) { + if ($l11n instanceof BaseStringL11n) { $this->l11n = $l11n; - } elseif (isset($this->l11n) && $this->l11n instanceof PromotionAttributeTypeL11n) { - $this->l11n->title = $l11n; + } elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) { + $this->l11n->content = $l11n; + $this->l11n->setLanguage($lang); } else { - $this->l11n = new PromotionAttributeTypeL11n(); - $this->l11n->title = $l11n; + $this->l11n = new BaseStringL11n(); + $this->l11n->content = $l11n; $this->l11n->setLanguage($lang); } } @@ -130,7 +132,11 @@ class PromotionAttributeType implements \JsonSerializable */ public function getL11n() : string { - return $this->l11n instanceof PromotionAttributeTypeL11n ? $this->l11n->title : $this->l11n; + if (!isset($this->l11n)) { + return ''; + } + + return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n; } /** diff --git a/Models/PromotionAttributeTypeL11nMapper.php b/Models/PromotionAttributeTypeL11nMapper.php index 6952e33..89be1fe 100755 --- a/Models/PromotionAttributeTypeL11nMapper.php +++ b/Models/PromotionAttributeTypeL11nMapper.php @@ -59,7 +59,7 @@ final class PromotionAttributeTypeL11nMapper extends DataMapperFactory /** * Model to use by the mapper. * - * @var string + * @var class-string * @since 1.0.0 */ public const MODEL = BaseStringL11n::class; diff --git a/Models/PromotionAttributeTypeMapper.php b/Models/PromotionAttributeTypeMapper.php index eb789e0..7d4496f 100755 --- a/Models/PromotionAttributeTypeMapper.php +++ b/Models/PromotionAttributeTypeMapper.php @@ -44,7 +44,7 @@ final class PromotionAttributeTypeMapper extends DataMapperFactory /** * Has many relation. * - * @var array + * @var array * @since 1.0.0 */ public const HAS_MANY = [ diff --git a/Models/PromotionAttributeValue.php b/Models/PromotionAttributeValue.php index 2890425..672e0d8 100755 --- a/Models/PromotionAttributeValue.php +++ b/Models/PromotionAttributeValue.php @@ -124,7 +124,7 @@ class PromotionAttributeValue implements \JsonSerializable /** * Set value * - * @param int|string|float|\DateTimeInterface $value Value + * @param int|string|float $value Value * * @return void * @@ -142,7 +142,7 @@ class PromotionAttributeValue implements \JsonSerializable } elseif ($datatype === AttributeValueType::_FLOAT) { $this->valueDec = (float) $value; } elseif ($datatype === AttributeValueType::_DATETIME) { - $this->valueDat = new \DateTime($value); + $this->valueDat = new \DateTime((string) $value); } } @@ -172,7 +172,7 @@ class PromotionAttributeValue implements \JsonSerializable * Set l11n * * @param string|BaseStringL11n $l11n Tag article l11n - * @param string $lang Language + * @param string $lang Language * * @return void * @@ -183,11 +183,12 @@ class PromotionAttributeValue implements \JsonSerializable if ($l11n instanceof BaseStringL11n) { $this->l11n = $l11n; } elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) { - $this->l11n->content = $l11n; + $this->l11n->content = $l11n; + $this->l11n->setLanguage($lang); } else { - $this->l11n = new BaseStringL11n(); + $this->l11n = new BaseStringL11n(); $this->l11n->content = $l11n; - $this->l11n->ref = $this->id; + $this->l11n->ref = $this->id; $this->l11n->setLanguage($lang); } } diff --git a/Models/PromotionAttributeValueMapper.php b/Models/PromotionAttributeValueMapper.php index cc90d2d..d5dc31a 100755 --- a/Models/PromotionAttributeValueMapper.php +++ b/Models/PromotionAttributeValueMapper.php @@ -44,7 +44,7 @@ final class PromotionAttributeValueMapper extends DataMapperFactory /** * Has many relation. * - * @var array + * @var array * @since 1.0.0 */ /* diff --git a/Models/PromotionMapper.php b/Models/PromotionMapper.php index 17037c9..480ffd0 100755 --- a/Models/PromotionMapper.php +++ b/Models/PromotionMapper.php @@ -56,7 +56,7 @@ final class PromotionMapper extends DataMapperFactory /** * Has many relation. * - * @var array + * @var array * @since 1.0.0 */ public const HAS_MANY = [ @@ -90,7 +90,7 @@ final class PromotionMapper extends DataMapperFactory /** * Has one relation. * - * @var array + * @var array * @since 1.0.0 */ public const OWNS_ONE = [ @@ -103,7 +103,7 @@ final class PromotionMapper extends DataMapperFactory /** * Belongs to. * - * @var array + * @var array * @since 1.0.0 */ public const BELONGS_TO = [ diff --git a/Theme/Backend/Lang/api.de.lang.php b/Theme/Backend/Lang/api.de.lang.php new file mode 100755 index 0000000..43498e6 --- /dev/null +++ b/Theme/Backend/Lang/api.de.lang.php @@ -0,0 +1,16 @@ + [ +]];