Hi I've using namespaces for my model. For example:
namespace My\\Namespace;
class Shop extends \\fActiveRecord {}
This seems to be a problem for tablzation of the class - as the class name is My\\Namespace\\Shop
. So I added:
fORM::mapClassToTable('My\\Namespace\\Shop', 'shops');
This works except for that I would have to add this for all my model classes.
So I tried changing the fORM::tablize() method instead, like this (uses only the last part of the class name):
static public function tablize($class)
{
if (!isset(self::$class_table_map[$class])) {
$stripped_class = $class;
$slash_position = strrpos($class, '\\\\');
if ($slash_position >=0) {
$stripped_class = substr($class, $slash_position + 1);
}
self::$class_table_map[$class] = fGrammar::underscorize(fGrammar::pluralize($stripped_class));
}
return self::$class_table_map[$class];
}
This will work as well, but naturally this will not do well with multiple models of the same name in different namespaces.
Is there a way of setting a default namespace or any other way of getting around this problem?
Any ideas are appreciated :)