|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of gpupo/netshoes-sdk |
|
5
|
|
|
* Created by Gilmar Pupo <[email protected]> |
|
6
|
|
|
* For the information of copyright and license you should read the file |
|
7
|
|
|
* LICENSE which is distributed with this source code. |
|
8
|
|
|
* Para a informação dos direitos autorais e de licença você deve ler o arquivo |
|
9
|
|
|
* LICENSE que é distribuído com este código-fonte. |
|
10
|
|
|
* Para obtener la información de los derechos de autor y la licencia debe leer |
|
11
|
|
|
* el archivo LICENSE que se distribuye con el código fuente. |
|
12
|
|
|
* For more information, see <http://www.g1mr.com/>. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace Gpupo\NetshoesSdk\Entity\Product\Sku; |
|
16
|
|
|
|
|
17
|
|
|
use Gpupo\CommonSdk\Entity\EntityAbstract; |
|
18
|
|
|
use Gpupo\CommonSdk\Entity\EntityInterface; |
|
19
|
|
|
use Gpupo\NetshoesSdk\Traits\DateTimeTrait; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @method float getPriceFrom() Acesso a priceFrom |
|
23
|
|
|
* @method setPriceFrom(float $priceFrom) Define priceFrom |
|
24
|
|
|
* @method float getPriceTo() Acesso a priceTo |
|
25
|
|
|
* @method setPriceTo(float $priceTo) Define priceTo |
|
26
|
|
|
* @method string getDateInit() Acesso a dateInit |
|
27
|
|
|
* @method setDateInit(string $dateInit) Define dateInit |
|
28
|
|
|
* @method string getDateEnd() Acesso a dateEnd |
|
29
|
|
|
* @method setDateEnd(string $dateEnd) Define dateEnd |
|
30
|
|
|
*/ |
|
31
|
|
|
final class PriceSchedule extends EntityAbstract implements EntityInterface |
|
32
|
|
|
{ |
|
33
|
|
|
use DateTimeTrait; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @codeCoverageIgnore |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getSchema() |
|
39
|
|
|
{ |
|
40
|
|
|
return [ |
|
41
|
|
|
'priceFrom' => 'number', |
|
42
|
|
|
'priceTo' => 'number', |
|
43
|
|
|
'dateInit' => 'string', |
|
44
|
|
|
'dateEnd' => 'string', |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
111 |
|
protected function setUp() |
|
49
|
|
|
{ |
|
50
|
111 |
|
$this->setOptionalSchema(['priceFrom', 'dateEnd']); |
|
51
|
111 |
|
} |
|
52
|
|
|
|
|
53
|
11 |
|
public function setDateInit($string) |
|
54
|
|
|
{ |
|
55
|
11 |
|
return parent::setDateInit($this->dateFormat($string)); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
11 |
|
public function setDateEnd($string) |
|
59
|
|
|
{ |
|
60
|
11 |
|
return parent::setDateEnd($this->dateFormat($string)); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
10 |
|
public function toArray() |
|
64
|
|
|
{ |
|
65
|
10 |
|
if ($this->elementEmpty('dateInit')) { |
|
66
|
10 |
|
$this->setDateInit(''); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
10 |
|
if ($this->elementEmpty('dateEnd')) { |
|
70
|
10 |
|
$this->setDateEnd(date('Y-m-d', strtotime('+1 month', strtotime('NOW')))); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
10 |
|
return parent::toArray(); |
|
74
|
|
|
} |
|
75
|
|
|
} |
|
76
|
|
|
|