| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function create () { |
||
| 27 | assert(!$this->hasGid()); |
||
| 28 | $path = static::DIR; |
||
| 29 | if (isset($this->parent)) { |
||
| 30 | assert($this->parent->hasGid()); |
||
| 31 | $path = "{$this->parent}/{$path}"; |
||
| 32 | } |
||
| 33 | $remote = $this->api->post($path, $this->toArray(true), ['expand' => 'this']); |
||
| 34 | $this->_setData($remote); |
||
| 35 | /** @var AbstractEntity $that */ |
||
| 36 | $that = $this; |
||
| 37 | $this->api->getPool()->add($that); |
||
| 38 | return $this; |
||
| 39 | } |
||
| 40 | } |