/** * Returns the bean data as it's needed by database to deal with database * * @return array Bean data represented as a database row */ public function toRow($getNulls = true) { $row = array(); $objectProperties = get_object_vars($this); foreach ($objectProperties as $property => $propertyValue) { $columnName = String::camelcaseUnderscorer($property); if ($getNulls === true) { $row[$columnName] = $this->getPropertyValue($propertyValue); } else { if ($propertyValue !== null) { $row[$columnName] = $this->getPropertyValue($propertyValue); } } } ksort($row); return $row; }
/** * Returns the bean setter method for a database column * * @param string $columnName * @return string */ protected function setterFromColumnName($columnName) { $propertyName = String::underscoreCamelCaser($columnName); return $this->setterFromPropertyName($propertyName); }