mirror of
https://github.com/Karaka-Management/oms-Marketing.git
synced 2026-02-10 15:38:41 +00:00
remove some getter/setter
This commit is contained in:
parent
d9c0f20a6a
commit
f47f0275dc
|
|
@ -56,7 +56,7 @@ class Promotion
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $description = '';
|
||||
public string $description = '';
|
||||
|
||||
private $calendar = null;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ class Promotion
|
|||
* @var \DateTimeImmutable
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private \DateTimeImmutable $createdAt;
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
/**
|
||||
* Created by.
|
||||
|
|
@ -86,7 +86,7 @@ class Promotion
|
|||
* @var Account
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private Account $createdBy;
|
||||
public Account $createdBy;
|
||||
|
||||
private $tasks = [];
|
||||
|
||||
|
|
@ -368,33 +368,7 @@ class Promotion
|
|||
public function setName(string $name) : void
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->calendar->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $description) : void
|
||||
{
|
||||
$this->description = $description;
|
||||
$this->calendar->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -474,40 +448,4 @@ class Promotion
|
|||
{
|
||||
$this->earnings = $earnings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created at
|
||||
*
|
||||
* @return \DateTimeImmutable
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedAt() : \DateTimeImmutable
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get created by
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getCreatedBy() : Account
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set creator
|
||||
*
|
||||
* @param Account $createdBy Creator
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setCreatedBy(Account $createdBy) : void
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<?php $count = 0; foreach ($list as $key => $value) : ++$count;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/prefix}marketing/promotion/profile?{?}&id=' . $value->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getName()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Start'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getStart()->format('Y-m-d')); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Due'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getEnd()->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr><td><input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($promotion->getStart()->format('Y-m-d\TH:i:s')); ?>">
|
||||
<td><input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($promotion->getEnd()->format('Y-m-d\TH:i:s')); ?>">
|
||||
<tr><td colspan="2"><label for="iDescription"><?= $this->getHtml('Description'); ?></label>
|
||||
<tr><td colspan="2"><textarea id="iDescription" name="desc"><?= $this->printHtml($promotion->getDescription()); ?></textarea>
|
||||
<tr><td colspan="2"><textarea id="iDescription" name="desc"><?= $this->printHtml($promotion->description); ?></textarea>
|
||||
<tr><td><label for="iBudget"><?= $this->getHtml('Budget'); ?></label><td><label for="iActual"><?= $this->getHtml('Actual'); ?></label>
|
||||
<tr><td><input type="text" id="iBudget" name="budget" placeholder=""><td><input type="text" id="iActual" name="actual">
|
||||
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ class PromotionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$promotion = new Promotion();
|
||||
|
||||
$promotion->setName('Promotionname');
|
||||
$promotion->setDescription('Description');
|
||||
$promotion->setCreatedBy(new NullAccount(1));
|
||||
$promotion->description = 'Description';
|
||||
$promotion->createdBy = new NullAccount(1);
|
||||
$promotion->setStart(new \DateTime('2000-05-05'));
|
||||
$promotion->setEnd(new \DateTime('2005-05-05'));
|
||||
|
||||
|
|
@ -49,23 +49,23 @@ class PromotionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$promotion->setEarnings($money);
|
||||
|
||||
$task = new Task();
|
||||
$task->setTitle('PromotionTask 1');
|
||||
$task->title = 'PromotionTask 1';
|
||||
$task->setCreatedBy(new NullAccount(1));
|
||||
|
||||
$task2 = new Task();
|
||||
$task2->setTitle('PromotionTask 2');
|
||||
$task2->title = 'PromotionTask 2';
|
||||
$task2->setCreatedBy(new NullAccount(1));
|
||||
|
||||
$promotion->addTask($task);
|
||||
$promotion->addTask($task2);
|
||||
|
||||
$media = new Media();
|
||||
$media->setCreatedBy(new NullAccount(1));
|
||||
$media->setDescription('desc');
|
||||
$media->createdBy = new NullAccount(1);
|
||||
$media->description = 'desc';
|
||||
$media->setPath('some/path');
|
||||
$media->setSize(11);
|
||||
$media->setExtension('png');
|
||||
$media->setName('Promotion Media');
|
||||
$media->size = 11;
|
||||
$media->extension = 'png';
|
||||
$media->name = 'Promotion Media';
|
||||
$promotion->addMedia($media);
|
||||
|
||||
$id = PromotionMapper::create($promotion);
|
||||
|
|
@ -75,19 +75,19 @@ class PromotionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$promotionR = PromotionMapper::get($promotion->getId());
|
||||
|
||||
self::assertEquals($promotion->getName(), $promotionR->getName());
|
||||
self::assertEquals($promotion->getDescription(), $promotionR->getDescription());
|
||||
self::assertEquals($promotion->description, $promotionR->description);
|
||||
self::assertEquals($promotion->countTasks(), $promotionR->countTasks());
|
||||
self::assertEquals($promotion->getCosts()->getAmount(), $promotionR->getCosts()->getAmount());
|
||||
self::assertEquals($promotion->getBudget()->getAmount(), $promotionR->getBudget()->getAmount());
|
||||
self::assertEquals($promotion->getEarnings()->getAmount(), $promotionR->getEarnings()->getAmount());
|
||||
self::assertEquals($promotion->getCreatedAt()->format('Y-m-d'), $promotionR->getCreatedAt()->format('Y-m-d'));
|
||||
self::assertEquals($promotion->createdAt->format('Y-m-d'), $promotionR->createdAt->format('Y-m-d'));
|
||||
self::assertEquals($promotion->getStart()->format('Y-m-d'), $promotionR->getStart()->format('Y-m-d'));
|
||||
self::assertEquals($promotion->getEnd()->format('Y-m-d'), $promotionR->getEnd()->format('Y-m-d'));
|
||||
|
||||
$expected = $promotion->getMedia();
|
||||
$actual = $promotionR->getMedia();
|
||||
|
||||
self::assertEquals(\end($expected)->getName(), \end($actual)->getName());
|
||||
self::assertEquals(\end($expected)->name, \end($actual)->name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -114,8 +114,8 @@ class PromotionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
$promotion = new Promotion();
|
||||
|
||||
$promotion->setName($text->generateText(\mt_rand(3, 7)));
|
||||
$promotion->setDescription($text->generateText(\mt_rand(20, 100)));
|
||||
$promotion->setCreatedBy(new NullAccount(1));
|
||||
$promotion->description = $text->generateText(\mt_rand(20, 100));
|
||||
$promotion->createdBy = new NullAccount(1);
|
||||
$promotion->setStart(new \DateTime('2000-05-05'));
|
||||
$promotion->setEnd(new \DateTime('2005-05-05'));
|
||||
|
||||
|
|
|
|||
|
|
@ -34,12 +34,12 @@ class PromotionTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
self::assertEquals(0, $promotion->getId());
|
||||
self::assertInstanceOf('\Modules\Calendar\Models\Calendar', $promotion->getCalendar());
|
||||
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $promotion->getCreatedAt()->format('Y-m-d'));
|
||||
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $promotion->createdAt->format('Y-m-d'));
|
||||
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $promotion->getStart()->format('Y-m-d'));
|
||||
self::assertEquals((new \DateTime('now'))->modify('+1 month')->format('Y-m-d'), $promotion->getEnd()->format('Y-m-d'));
|
||||
self::assertEquals(0, $promotion->getCreatedBy()->getId());
|
||||
self::assertEquals(0, $promotion->createdBy->getId());
|
||||
self::assertEquals('', $promotion->getName());
|
||||
self::assertEquals('', $promotion->getDescription());
|
||||
self::assertEquals('', $promotion->description);
|
||||
self::assertEquals(0, $promotion->getCosts()->getInt());
|
||||
self::assertEquals(0, $promotion->getBudget()->getInt());
|
||||
self::assertEquals(0, $promotion->getEarnings()->getInt());
|
||||
|
|
@ -59,8 +59,8 @@ class PromotionTest extends \PHPUnit\Framework\TestCase
|
|||
$promotion->setName('Promotion');
|
||||
self::assertEquals('Promotion', $promotion->getName());
|
||||
|
||||
$promotion->setDescription('Description');
|
||||
self::assertEquals('Description', $promotion->getDescription());
|
||||
$promotion->description = 'Description';
|
||||
self::assertEquals('Description', $promotion->description);
|
||||
|
||||
$promotion->setStart($date = new \DateTime('2000-05-05'));
|
||||
self::assertEquals($date->format('Y-m-d'), $promotion->getStart()->format('Y-m-d'));
|
||||
|
|
@ -81,12 +81,12 @@ class PromotionTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($money->getAmount(), $promotion->getEarnings()->getAmount());
|
||||
|
||||
$task = new Task();
|
||||
$task->setTitle('Promo Task A');
|
||||
$task->title = 'Promo Task A';
|
||||
$task->setCreatedBy(new NullAccount(1));
|
||||
|
||||
$promotion->addTask($task);
|
||||
|
||||
self::assertEquals('Promo Task A', $promotion->getTask(0)->getTitle());
|
||||
self::assertEquals('Promo Task A', $promotion->getTask(0)->title);
|
||||
self::assertCount(1, $promotion->getTasks());
|
||||
self::assertTrue($promotion->removeTask(0));
|
||||
self::assertEquals(0, $promotion->countTasks());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user