/** * {@inheritdoc} * * @param bool $allFields Allows to show all the fields * @param bool $recursive Convert this method in recursive * @param bool $convertToDatabase Convert property names to database * * @return stdClass */ public function toObject($allFields = false, $recursive = false, $convertToDatabase = true) { $data = parent::toObject($allFields, $recursive, $convertToDatabase); if ($this->element instanceof NenoObject) { $data->content_id = $this->element->getId(); } elseif (!empty($this->element)) { $data->content_id = $this->element->id; } return $data; }
/** * {@inheritdoc} * * @param bool $allFields Allows to show all the fields * @param bool $recursive Convert this method in recursive * @param bool $convertToDatabase Convert property names to database * * @return stdClass */ public function toObject($allFields = false, $recursive = false, $convertToDatabase = true) { $object = parent::toObject($allFields, $recursive, $convertToDatabase); if (!empty($this->group) && $convertToDatabase) { $object->group_id = $this->group->getId(); } // If it's an array, let's json it! if (is_array($this->primaryKey) && $convertToDatabase) { $object->primary_key = json_encode($this->primaryKey); } return $object; }
/** * {@inheritdoc} * * @param bool $allFields Allows to show all the fields * @param bool $recursive Convert this method in recursive * @param bool $convertToDatabase Convert property names to database * * @return stdClass */ public function toObject($allFields = false, $recursive = false, $convertToDatabase = true) { $object = parent::toObject($allFields, $recursive, $convertToDatabase); // If the table property is not null and it's an instance of NenoObject, let's use the getId method if (!empty($this->table) && $this->table instanceof NenoObject && $convertToDatabase) { $object->table_id = $this->table->getId(); } elseif (!empty($this->table) && $convertToDatabase) { /* @var $table stdClass */ $table = $this->table; $object->table_id = $table->id; } return $object; }
/** * {@inheritdoc} * * @param bool $allFields Allows to show all the fields * @param bool $recursive Convert this method in recursive * @param bool $convertToDatabase Convert property names to database * * @return stdClass */ public function toObject($allFields = false, $recursive = false, $convertToDatabase = true) { $object = parent::toObject($allFields, $recursive, $convertToDatabase); if (!empty($this->group) && $convertToDatabase) { $object->group_id = $this->group->getId(); } return $object; }
/** * {@inheritdoc} * * @param bool $allFields Allows to show all the fields * @param bool $recursive Convert this method in recursive * @param bool $convertToDatabase Convert property names to database * * @return stdClass */ public function toObject($allFields = false, $recursive = false, $convertToDatabase = true) { $data = parent::toObject($allFields, $recursive, $convertToDatabase); if (!empty($this->languageFile)) { $data->languagefile_id = $this->languageFile->getId(); } if ($this->timeAdded instanceof DateTime) { $this->timeAdded = $this->timeAdded->format('Y-m-d H:i:s'); } return $data; }