/** * Get the instance as an array. * * @return array */ public function toArray() { $return = get_object_public_vars($this); foreach ($return as $key => $value) { if (is_null($value)) { unset($return[$key]); } } return $return; }
/** * Returns all of $this object's public properties as an associative array. * * @return array */ public function to_array() { return get_object_public_vars($this); }
private function _getNonNullProps() { foreach (get_object_public_vars($this) as $key => $value) { if ($value !== null) { $nonnull[$key] = $value; } } return isset($nonnull) ? $nonnull : []; }
/** * Get all the attributes of the model. * * @return array */ public function attributes() { $attributes = get_object_public_vars($this); unset($attributes['children']); unset($attributes['parent']); return $attributes; }
/** * Returns the column names of the model that have been set for current * object. * * The column names are determined from public object vars. * * @return array */ public function getSetColumnNames() { return array_keys(get_object_public_vars($this)); }
/** * Get the instance as an array. * * @return array */ public function toArray() { $return = get_object_public_vars($this); return $return; }