-
Notifications
You must be signed in to change notification settings - Fork 131
Neither short table name nor user defined table name used in has_many_through() method #105
Copy link
Copy link
Closed
Description
I have a model class using namespace : \BenGee\Slim\Auth\User
This class contains :
public static $_table_use_short_name = true;
I have two other model classes using namespace also :
\BenGee\Slim\Auth\Group
\BenGee\Slim\Auth\GroupUser
These model classes also contain :
public static $_table_use_short_name = true;
I have the three following tables in database :
- user
- group
- group_user
In my User class, I have a method :
public function isMember($group)
{
$isMember = false;
$groups = $this->has_many_through('\\BenGee\\Slim\\Auth\\Group')->where('label', $group)->find_many();
return $isMember;
}When running, I get the following exception :
exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'slim.user_ben_gee_slim_auth_group' doesn't exist' in D:\DEV\GIT\slim-auth\vendor\j4mie\idiorm\idiorm.php:429
Stack trace:
#0 D:\DEV\GIT\slim-auth\vendor\j4mie\idiorm\idiorm.php(429): PDOStatement->execute()
#1 D:\DEV\GIT\slim-auth\vendor\j4mie\idiorm\idiorm.php(1828): ORM::_execute('SELECT `group`....', Array, 'default')
#2 D:\DEV\GIT\slim-auth\vendor\j4mie\idiorm\idiorm.php(638): ORM->_run()
#3 D:\DEV\GIT\slim-auth\vendor\j4mie\idiorm\idiorm.php(627): ORM->_find_many()
#4 D:\DEV\GIT\slim-auth\vendor\j4mie\paris\paris.php(146): ORM->find_many()
#5 D:\DEV\GIT\slim-auth\src\BenGee\Slim\Auth\User.php(56): ORMWrapper->find_many()
It should look for \BenGee\Slim\Auth\Group class and use table name from it according model class settings or then guess one if the class doesn't exist.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels