alex-kalanis /
pohoda
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace kalanis\Pohoda; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * @property StockTransfer\StockTransferDto $data |
||
| 9 | */ |
||
| 10 | class StockTransfer extends AbstractAgenda |
||
| 11 | { |
||
| 12 | use Common\AddParameterToHeaderTrait; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * {@inheritdoc} |
||
| 16 | */ |
||
| 17 | 4 | public function setData(Common\Dtos\AbstractDto $data): parent |
|
| 18 | { |
||
| 19 | // pass to header |
||
| 20 | 4 | $header = new StockTransfer\Header($this->dependenciesFactory); |
|
| 21 | 4 | $header |
|
| 22 | 4 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 23 | 4 | ->setResolveOptions($this->resolveOptions) |
|
| 24 | 4 | ->setData($data); |
|
| 25 | 4 | $data = new StockTransfer\StockTransferDto(); |
|
| 26 | 4 | $data->header = $header; |
|
| 27 | |||
| 28 | 4 | return parent::setData($data); |
|
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 29 | } |
||
| 30 | |||
| 31 | 1 | public function getImportRoot(): string |
|
| 32 | { |
||
| 33 | 1 | return 'lst:prevodka'; |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Add item. |
||
| 38 | * |
||
| 39 | * @param StockTransfer\ItemDto $data |
||
| 40 | * |
||
| 41 | * @return $this |
||
| 42 | */ |
||
| 43 | 1 | public function addItem(StockTransfer\ItemDto $data): self |
|
| 44 | { |
||
| 45 | 1 | $prevodkaDetail = new StockTransfer\Item($this->dependenciesFactory); |
|
| 46 | 1 | $prevodkaDetail |
|
| 47 | 1 | ->setDirectionalVariable($this->useOneDirectionalVariables) |
|
| 48 | 1 | ->setResolveOptions($this->resolveOptions) |
|
| 49 | 1 | ->setData($data); |
|
| 50 | 1 | $this->data->prevodkaDetail[] = $prevodkaDetail; |
|
| 51 | |||
| 52 | 1 | return $this; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | 3 | public function getXML(): \SimpleXMLElement |
|
| 59 | { |
||
| 60 | 3 | $xml = $this->createXML()->addChild('pre:prevodka', '', $this->namespace('pre')); |
|
| 61 | 3 | $xml->addAttribute('version', '2.0'); |
|
| 62 | |||
| 63 | 3 | $this->addElements($xml, $this->getDataElements(), 'pre'); |
|
| 64 | |||
| 65 | 3 | return $xml; |
|
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * {@inheritdoc} |
||
| 70 | */ |
||
| 71 | 4 | protected function getDefaultDto(): Common\Dtos\AbstractDto |
|
| 72 | { |
||
| 73 | 4 | return new StockTransfer\StockTransferDto(); |
|
| 74 | } |
||
| 75 | } |
||
| 76 |