public function toArray() { $data = parent::toArray(); if ($this->url instanceof AbstractEntity) { $data['url'] = $this->url->getId() > 0 ? $this->url->toArray() : null; } return $data; }
public function toArray() { $data = parent::toArray(); if ($this->categoriapai instanceof AbstractEntity) { $data['categoriapai'] = $this->categoriapai->getId() >= 0 && $this->categoriapai->getId() !== '' ? $this->categoriapai->getId() === 0 ? (new Categoria(['id' => 0]))->toArray() : $this->categoriapai->toArray() : null; } if ($this->url instanceof AbstractEntity) { $data['url'] = $this->url->getId() > 0 ? $this->url->toArray() : null; } return $data; }