Permalink
Browse files

BackwardsCompatibilityBreak - fORM::getClassName() was renamed to fOR…

…M::getClass() and fRecordSet::getClassName() was renamed to fRecordSet::getClass()
  • Loading branch information...
wbond committed Sep 14, 2008
1 parent 3983176 commit dc35e6a8e597311ec6204c5bffb4ae3f343f8b8b
View
@@ -109,7 +109,7 @@ static public function addCustomTableClassMapping($table, $class)
*/
static public function callHookCallback(fActiveRecord $object, $hook, &$values, &$old_values, &$related_records, &$first_parameter=NULL, &$second_parameter=NULL)
{
$class = self::getClassName($object);
$class = self::getClass($object);
if ((!isset(self::$hook_callbacks[$class]) && !isset(self::$hook_callbacks['*'])) ||
(empty(self::$hook_callbacks[$class][$hook]) && empty(self::$hook_callbacks['*'][$hook]))) {
@@ -173,7 +173,7 @@ static public function callHookCallback(fActiveRecord $object, $hook, &$values,
*/
static public function callReflectCallbacks(fActiveRecord $object, &$signatures, $include_doc_comments)
{
$class = self::getClassName($object);
$class = self::getClass($object);
if (!isset(self::$reflect_callbacks[$class]) && !isset(self::$reflect_callbacks['*'])) {
return;
@@ -217,7 +217,7 @@ static public function callReflectCallbacks(fActiveRecord $object, &$signatures,
*/
static public function checkHookCallback($class, $hook, $callback=NULL)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if ((!isset(self::$hook_callbacks[$class]) && !isset(self::$hook_callbacks['*'])) ||
(empty(self::$hook_callbacks[$class][$hook]) && empty(self::$hook_callbacks['*'][$hook]))) {
@@ -251,7 +251,7 @@ static public function checkHookCallback($class, $hook, $callback=NULL)
*/
static public function checkIdentityMap($class, $primary_key_data)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!isset(self::$identity_map[$class])) {
return FALSE;
@@ -341,7 +341,7 @@ static private function createPrimaryKeyHash($primary_key_data)
*/
static public function flagConfigured($class)
{
$class = self::getClassName($class);
$class = self::getClass($class);
self::$configured[$class] = TRUE;
}
@@ -351,10 +351,10 @@ static public function flagConfigured($class)
*
* @internal
*
* @param mixed $class The class to get the name of
* @param mixed $class The object to get the name of, or possibly a string already containing the class
* @return string The class name
*/
static public function getClassName($class)
static public function getClass($class)
{
if (is_object($class)) { return get_class($class); }
return $class;
@@ -372,7 +372,7 @@ static public function getClassName($class)
*/
static public function getColumnName($class, $column)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!isset(self::$column_names[$class])) {
self::$column_names[$class] = array();
@@ -396,7 +396,7 @@ static public function getColumnName($class, $column)
*/
static public function getRecordName($class)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!isset(self::$record_names[$class])) {
self::$record_names[$class] = fGrammar::humanize($class);
@@ -416,7 +416,7 @@ static public function getRecordName($class)
*/
static public function isConfigured($class)
{
$class = self::getClassName($class);
$class = self::getClass($class);
return !empty(self::$configured[$class]);
}
@@ -433,7 +433,7 @@ static public function isConfigured($class)
*/
static public function objectify($class, $column, $value)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!empty(self::$objectify_callbacks[$class][$column])) {
return call_user_func(self::$objectify_callbacks[$class][$column], $class, $column, $value);
@@ -473,7 +473,7 @@ static public function objectify($class, $column, $value)
*/
static public function overrideColumnName($class, $column, $column_name)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!isset(self::$column_names[$class])) {
self::$column_names[$class] = array();
@@ -492,7 +492,7 @@ static public function overrideColumnName($class, $column, $column_name)
*/
static public function overrideRecordName($class, $record_name)
{
$class = self::getClassName($class);
$class = self::getClass($class);
self::$record_names[$class] = $record_name;
}
@@ -522,7 +522,7 @@ static public function overrideRecordName($class, $record_name)
*/
static public function registerHookCallback($class, $hook, $callback)
{
$class = self::getClassName($class);
$class = self::getClass($class);
$replace_hook = preg_match('#^replace::[\w_]+\(\)$#', $hook);
static $valid_hooks = array(
@@ -616,7 +616,7 @@ static public function registerHookCallback($class, $hook, $callback)
*/
static public function registerObjectifyCallback($class, $column, $callback)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!isset(self::$objectify_callbacks[$class])) {
self::$objectify_callbacks[$class] = array();
@@ -644,7 +644,7 @@ static public function registerObjectifyCallback($class, $column, $callback)
*/
static public function registerReflectCallback($class, $callback)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!isset(self::$reflect_callbacks[$class])) {
self::$reflect_callbacks[$class] = array();
@@ -666,7 +666,7 @@ static public function registerReflectCallback($class, $callback)
*/
static public function registerScalarizeCallback($class, $column, $callback)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!isset(self::$scalarize_callbacks[$class])) {
self::$scalarize_callbacks[$class] = array();
@@ -687,7 +687,7 @@ static public function registerScalarizeCallback($class, $column, $callback)
*/
static public function saveToIdentityMap($object, $primary_key_data)
{
$class = self::getClassName($object);
$class = self::getClass($object);
if (!isset(self::$identity_map[$class])) {
self::$identity_map[$class] = array();
@@ -711,7 +711,7 @@ static public function saveToIdentityMap($object, $primary_key_data)
*/
static public function scalarize($class, $column, $value)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!empty(self::$scalarize_callbacks[$class][$column])) {
return call_user_func(self::$scalarize_callbacks[$class][$column], $class, $column, $value);
@@ -727,12 +727,12 @@ static public function scalarize($class, $column, $value)
/**
* Takes a class name (or class) and turns it into a table name. Uses custom mapping if set.
*
* @param mixed $class The name of the class or the class to extract the name from
* @param mixed $class he class name or instance of the class
* @return string The table name
*/
static public function tablize($class)
{
$class = self::getClassName($class);
$class = self::getClass($class);
if (!$table = array_search($class, self::$table_class_map)) {
$table = fGrammar::underscorize(fGrammar::pluralize($class));
View
@@ -52,7 +52,7 @@ class fORMColumn
*/
static public function configureEmailColumn($class, $column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
@@ -100,7 +100,7 @@ static public function configureEmailColumn($class, $column)
*/
static public function configureLinkColumn($class, $column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
@@ -159,7 +159,7 @@ static public function configureLinkColumn($class, $column)
*/
static public function configureNumberColumn($class, $column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
@@ -226,7 +226,7 @@ static public function configureNumberColumn($class, $column)
*/
static public function configureRandomColumn($class, $column, $type, $length)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
View
@@ -52,7 +52,7 @@ class fORMDate
*/
static public function configureDateCreatedColumn($class, $column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
@@ -100,7 +100,7 @@ static public function configureDateCreatedColumn($class, $column)
*/
static public function configureDateUpdatedColumn($class, $column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
@@ -149,7 +149,7 @@ static public function configureDateUpdatedColumn($class, $column)
*/
static public function configureTimezoneColumn($class, $timestamp_column, $timezone_column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$timestamp_data_type = fORMSchema::getInstance()->getColumnInfo($table, $timestamp_column, 'type');
View
@@ -78,7 +78,7 @@ class fORMFile
*/
static public function addFImageMethodCall($class, $column, $method, $parameters=array())
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
if (!array_key_exists($column, self::$image_upload_columns[$class])) {
fCore::toss(
@@ -115,7 +115,7 @@ static public function addFImageMethodCall($class, $column, $method, $parameters
*/
static public function addFUploadMethodCall($class, $column, $method, $parameters=array())
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
if (empty(self::$file_upload_columns[$class][$column])) {
fCore::toss(
@@ -195,7 +195,7 @@ static public function commit()
*/
static public function configureFileUploadColumn($class, $column, $directory)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
@@ -307,7 +307,7 @@ static public function configureFileUploadColumn($class, $column, $directory)
*/
static public function configureColumnInheritance($class, $column, $inherit_from_column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
if (empty(self::$column_inheritence[$class])) {
self::$column_inheritence[$class] = array();
@@ -347,7 +347,7 @@ static public function configureImageUploadColumn($class, $column, $directory, $
self::configureFileUploadColumn($class, $column, $directory);
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
if (empty(self::$image_upload_columns[$class])) {
self::$image_upload_columns[$class] = array();
View
@@ -39,7 +39,7 @@ class fORMMoney
*/
static public function configureMoneyColumn($class, $column, $currency_column=NULL)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
View
@@ -34,7 +34,7 @@ class fORMOrdering
*/
static public function configureOrderingColumn($class, $column)
{
$class = fORM::getClassName($class);
$class = fORM::getClass($class);
$table = fORM::tablize($class);
$data_type = fORMSchema::getInstance()->getColumnInfo($table, $column, 'type');
$unique_keys = fORMSchema::getInstance()->getKeys($table, 'unique');
@@ -481,7 +481,7 @@ static public function reorder($object, &$values, &$old_values, &$related_record
*/
static public function validate($object, &$values, &$old_values, &$related_records, &$validation_messages)
{
$class = fORM::getClassName($object);
$class = fORM::getClass($object);
$table = fORM::tablize($class);
$column = self::$ordering_columns[$class]['column'];
View
@@ -87,7 +87,7 @@ static public function buildRecords($class, &$values, &$related_records, $relate
} else {
// When joining to the same table, we have to use a different column
$same_class = $related_class == fORM::getClassName($class);
$same_class = $related_class == fORM::getClass($class);
if ($same_class && isset($relationship['join_table'])) {
$column = $table . '{' . $relationship['join_table'] . '}.' . $relationship['column'];
} elseif ($same_class) {
@@ -259,7 +259,7 @@ static public function getRelatedRecordName($class, $related_class, $route=NULL)
{
$table = fORM::tablize($class);
$related_class = fORM::getClassName($related_class);
$related_class = fORM::getClass($related_class);
$related_table = fORM::tablize($related_class);
$route = fORMSchema::getRouteName($table, $related_table, $route, '*-to-many');
@@ -322,7 +322,7 @@ static public function overrideRelatedRecordName($class, $related_class, $record
{
$table = fORM::tablize($class);
$related_class = fORM::getClassName($related_class);
$related_class = fORM::getClass($related_class);
$related_table = fORM::tablize($related_class);
$route = fORMSchema::getRouteName($table, $related_table, $route, '*-to-many');
@@ -600,7 +600,7 @@ static public function storeOneToMany(&$values, $relationship, $record_set)
$relationship['related_column'] . '=' => $column_value
);
$related_class = $record_set->getClassName();
$related_class = $record_set->getClass();
$existing_records = fRecordSet::build($related_class, $where_conditions);
$existing_primary_keys = $existing_records->getPrimaryKeys();
Oops, something went wrong.

0 comments on commit dc35e6a

Please sign in to comment.