mirror of
https://github.com/Karaka-Management/oms-Marketing.git
synced 2026-02-08 06:28:40 +00:00
fixes Orange-Management/phpOMS#224 and fixes Orange-Management/phpOMS#212
This commit is contained in:
parent
3d83829c13
commit
d4fddbc842
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Marketing\Models;
|
||||
|
||||
use Modules\Admin\Models\Account;
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\Calendar\Models\Calendar;
|
||||
use Modules\Tasks\Models\Task;
|
||||
use phpOMS\Localization\Money;
|
||||
|
|
@ -80,10 +82,10 @@ class Promotion
|
|||
/**
|
||||
* Created by.
|
||||
*
|
||||
* @var int|\Modules\Admin\Models\Account
|
||||
* @var Account
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $createdBy = 0;
|
||||
private Account $createdBy;
|
||||
|
||||
private $tasks = [];
|
||||
|
||||
|
|
@ -100,6 +102,7 @@ class Promotion
|
|||
$this->end = new \DateTime('now');
|
||||
$this->end->modify('+1 month');
|
||||
$this->createdAt = new \DateTime('now');
|
||||
$this->createdBy = new NullAccount();
|
||||
|
||||
$this->calendar = new Calendar();
|
||||
|
||||
|
|
@ -486,11 +489,11 @@ class Promotion
|
|||
/**
|
||||
* Get created by
|
||||
*
|
||||
* @return int|\Modules\Admin\Models\Account
|
||||
* @return Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedBy()
|
||||
public function getCreatedBy() : Account
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
|
@ -498,11 +501,11 @@ class Promotion
|
|||
/**
|
||||
* Set creator
|
||||
*
|
||||
* @param int $createdBy Creator
|
||||
* @param Account $createdBy Creator
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCreatedBy(int $createdBy) : void
|
||||
public function setCreatedBy(Account $createdBy) : void
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Marketing\Models;
|
||||
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Calendar\Models\CalendarMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Tasks\Models\TaskMapper;
|
||||
|
|
@ -47,7 +48,7 @@ final class PromotionMapper extends DataMapperAbstract
|
|||
'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_type' => ['name' => 'marketing_promotion_progress_type', 'type' => 'int', 'internal' => 'progressType'],
|
||||
'marketing_promotion_created_by' => ['name' => 'marketing_promotion_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||
'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' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true],
|
||||
];
|
||||
|
||||
|
|
@ -85,6 +86,19 @@ final class PromotionMapper extends DataMapperAbstract
|
|||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Belongs to.
|
||||
*
|
||||
* @var array<string, array{mapper:string, self:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $belongsTo = [
|
||||
'createdBy' => [
|
||||
'mapper' => AccountMapper::class,
|
||||
'self' => 'marketing_promotion_created_by',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user