4spacesdk / CI4OrmExtension

OrmExtension for CodeIgniter 4
MIT License
50 stars 9 forks source link

Is it possible to get table names from models? #20

Closed etcware closed 2 years ago

etcware commented 2 years ago

It seems that table names must be derived from entity name with english language rules: I suppose this rule is due to guess relationship tables names: is it possible to change this rules and pass table names to functions? I need to work with an existing database and changing all table names is a mess.

 public function getTableName() {
        return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', plural($this->getEntityName())));
    }