Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Fix table name pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
panlatent committed Feb 26, 2019
1 parent 5aaa1ae commit 4ecc564
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gii/generators/model/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public function getName()
return 'Odoo Model Generator';
}

/**
* @inheritdoc
*/
public function rules()
{
return [
Expand All @@ -59,7 +62,7 @@ public function rules()
[['db', 'ns', 'tableName', 'baseClass', 'queryNs', 'queryBaseClass'], 'required'],
[['db', 'modelClass', 'queryClass'], 'match', 'pattern' => '/^\w+$/', 'message' => 'Only word characters are allowed.'],
[['ns', 'baseClass', 'queryNs', 'queryBaseClass'], 'match', 'pattern' => '/^[\w\\\\]+$/', 'message' => 'Only word characters and backslashes are allowed.'],
[['tableName'], 'match', 'pattern' => '/^([\w ]+\.)?([\w\* ]+)$/', 'message' => 'Only word characters, and optionally spaces, an asterisk and/or a dot are allowed.'],
[['tableName'], 'match', 'pattern' => '/^([\w ]+\.)?([\w\*\. ]+)$/', 'message' => 'Only word characters, and optionally spaces, an asterisk and/or a dot are allowed.'],
[['db'], 'validateDb'],
[['ns', 'queryNs'], 'validateNamespace'],
[['tableName'], 'validateTableName'],
Expand Down Expand Up @@ -128,6 +131,9 @@ protected function generateClassName($tableName, $useSchemaName = null)
return $this->classNames[$tableName] = Inflector::id2camel($tableName, '.');
}

/**
* @inheritdoc
*/
protected function generateRelations()
{
if ($this->generateRelations === self::RELATIONS_NONE) {
Expand Down

0 comments on commit 4ecc564

Please sign in to comment.