/** * Initializes and returns a new subclassesd object * @param class String of class name to inialize instance with * which must be a subclass of DataCenterDBRow * @param category String of category name to set * @param type String of type name to set * @param values Array of field => value pairs to set */ public static function newFromClass($class, $category, $type, array $values = array()) { if (!DataCenterDB::isRowClass($class)) { throw new MWException($class . ' is not an compatable with DataCenterDBRow'); } if (!DataCenterDB::isType($category, $type)) { throw new MWException($category . '/' . $type . ' is not a valid type'); } $rowObject = new $class($category, $type); if (count($values) > 0) { $rowObject->set($values); } return $rowObject; }