Hi guys , i switched to yii2
but during the creation of a model in GII i got this error
someone knows why ?
cheers
Hi guys , i switched to yii2
but during the creation of a model in GII i got this error
someone knows why ?
cheers
Which version of yii you installed ?
And please show full stacktrace.
Hi Pasman , thank you for your answer
YII Boilerplate from here
the entire error is that , maybe i missed something…
1. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2-gii\generators\model\Generator.php at line 236
227228229230231232233234235236237238239240241242243244245 case Schema::TYPE_SMALLINT:
case Schema::TYPE_INTEGER:
case Schema::TYPE_BIGINT:
$types['integer'][] = $column->name;
break;
case Schema::TYPE_BOOLEAN:
$types['boolean'][] = $column->name;
break;
case Schema::TYPE_FLOAT:
case Schema::TYPE_DOUBLE:
case Schema::TYPE_DECIMAL:
case Schema::TYPE_MONEY:
$types['number'][] = $column->name;
break;
case Schema::TYPE_DATE:
case Schema::TYPE_TIME:
case Schema::TYPE_DATETIME:
case Schema::TYPE_TIMESTAMP:
$types['safe'][] = $column->name;
2. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2-gii\controllers\DefaultController.php – yii\gii\generators\model\Generator::generate() at line 45
39404142434445464748495051 {
$generator = $this->loadGenerator($id);
$params = ['generator' => $generator, 'id' => $id];
if (isset($_POST['preview']) || isset($_POST['generate'])) {
if ($generator->validate()) {
$generator->saveStickyAttributes();
$files = $generator->generate();
if (isset($_POST['generate']) && !empty($_POST['answers'])) {
$params['hasError'] = !$generator->save($files, (array) $_POST['answers'], $results);
$params['results'] = $results;
} else {
$params['files'] = $files;
$params['answers'] = isset($_POST['answers']) ? $_POST['answers'] : null;
3. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2\base\InlineAction.php – yii\gii\controllers\DefaultController::actionView() at line 55
4. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2\base\InlineAction.php – call_user_func_array:{C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2\base\InlineAction.php:55}() at line 55
5. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2\base\Controller.php – yii\base\InlineAction::runWithParams() at line 151
6. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2\base\Module.php – yii\base\Controller::runAction() at line 455
7. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2\web\Application.php – yii\base\Module::runAction() at line 83
8. in C:\wamp\www\yii2-starter-kit\vendor\yiisoft\yii2\base\Application.php – yii\web\Application::handleRequest() at line 375
9. in C:\wamp\www\yii2-starter-kit\frontend\web\index.php – yii\base\Application::run() at line 22
16171819202122 require(__DIR__ . '/../../common/config/base.php'),
require(__DIR__ . '/../../common/config/web.php'),
require(__DIR__ . '/../config/base.php'),
require(__DIR__ . '/../config/web.php')
);
(new yii\web\Application($config))->run();
$_GET = [
'id' => 'model',
];
$_POST = [
'_csrf' => 'OVJLcXYxeEVyHhI/LEBMAVoiJhxDRTATdmMyHS9jO3FXIDM6Lnc6DQ==',
'Generator' => [
'tableName' => 'veicolo',
'modelClass' => 'Veicolo',
'ns' => 'app\\models',
'baseClass' => 'yii\\db\\ActiveRecord',
'db' => 'db',
'useTablePrefix' => '0',
'generateRelations' => '1',
'generateLabelsFromComments' => '0',
'enableI18N' => '1',
'messageCategory' => 'cars',
'template' => 'default',
],
'preview' => '',
];
$_SERVER = [
'REDIRECT_STATUS' => '200',
'HTTP_HOST' => 'localhost',
'HTTP_CONNECTION' => 'keep-alive',
'CONTENT_LENGTH' => '515',
'HTTP_CACHE_CONTROL' => 'max-age=0',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'HTTP_ORIGIN' => 'http://localhost',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36',
'CONTENT_TYPE' => 'application/x-www-form-urlencoded',
'HTTP_REFERER' => 'http://localhost/yii2-starter-kit/frontend/web/gii/model',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'HTTP_ACCEPT_LANGUAGE' => 'it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4',
'HTTP_COOKIE' => '_locale=7da174d6a3fba2d2984618bfc44a806a8b4c14d99440370965606bdec9843b6ea%3A2%3A%7Bi%3A0%3Bs%3A7%3A%22_locale%22%3Bi%3A1%3Bs%3A5%3A%22en-US%22%3B%7D; PHPSESSID=mkoe437muuaat3lus810147v03; _csrf=f86f4cda6fa32f8ff87f3afade2799df92eed6386cd94f54ec47c5cc975d27c4a%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22KLYNZq4Dcpmm5tHVO1ylYRC4nrxKXFBH%22%3B%7D; _identity=a1727827474024bfbee201f164d86434dfa7f1e2de7ff5b962ff923c58f55a28a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A46%3A%22%5B1%2C%22mHqUDw8LqBJqdkJ7JreToXtNnPWsVBOO%22%2C2592000%5D%22%3B%7D',
'PATH' => 'C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C:\\Program Files\\Broadcom\\Broadcom 802.11 Network Adapter\\Driver;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\ZipGenius 6\\;C:\\Program Files\\MATLAB\\R2010a\\runtime\\win64;C:\\Program Files\\MATLAB\\R2010a\\bin;C:\\Program Files (x86)\\GTK2-Runtime\\lib;C:\\ProgramData\\ComposerSetup\\bin;C:\\Program Files (x86)\\nodejs\\;C:\\Program Files (x86)\\MySQL\\MySQL Utilities\\;C:\\Program Files (x86)\\MySQL\\MySQL Utilities\\Doctrine extensions for PHP\\;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\wamp\\bin\\php\\php5.5.12;C:\\Program Files (x86)\\QuickTime\\QTSystem\\;C:\\Program Files (x86)\\Common Files\\Ulead Systems\\MPEG;',
'SystemRoot' => 'C:\\Windows',
'COMSPEC' => 'C:\\Windows\\system32\\cmd.exe',
'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY',
'WINDIR' => 'C:\\Windows',
'SERVER_SIGNATURE' => '
Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.12 Server at localhost Port 80
',
'SERVER_SOFTWARE' => 'Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.12',
'SERVER_NAME' => 'localhost',
'SERVER_ADDR' => '127.0.0.1',
'SERVER_PORT' => '80',
'REMOTE_ADDR' => '127.0.0.1',
'DOCUMENT_ROOT' => 'C:/wamp/www',
'REQUEST_SCHEME' => 'http',
'CONTEXT_PREFIX' => '',
'CONTEXT_DOCUMENT_ROOT' => 'C:/wamp/www',
'SERVER_ADMIN' => 'xxxx@gmail.com',
'SCRIPT_FILENAME' => 'C:/wamp/www/yii2-starter-kit/frontend/web/index.php',
'REMOTE_PORT' => '56908',
'REDIRECT_URL' => '/yii2-starter-kit/frontend/web/gii/model',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_METHOD' => 'POST',
'QUERY_STRING' => '',
'REQUEST_URI' => '/yii2-starter-kit/frontend/web/gii/model',
'SCRIPT_NAME' => '/yii2-starter-kit/frontend/web/index.php',
'PHP_SELF' => '/yii2-starter-kit/frontend/web/index.php',
'REQUEST_TIME_FLOAT' => 1424975608.095,
'REQUEST_TIME' => 1424975608,
'YII_DEBUG' => 'true',
'YII_ENV' => 'dev',
'DB_DSN' => 'mysql:host=localhost;port=3306;dbname=noleggio',
'DB_USERNAME' => 'root',
'DB_PASSWORD' => '',
'DB_TABLE_PREFIX' => '',
'FRONTEND_URL' => 'http://localhost/yii2-starter-kit/frontend/web/',
'BACKEND_URL' => 'http://localhost/yii2-starter-kit/backend/web/',
'STORAGE_URL' => 'http://localhost/yii2-starter-kit/storage/',
'FRONTEND_COOKIE_VALIDATION_KEY' => 'dwmCa55rdn8OqXOVkiNU362Dutzx4pRT',
'BACKEND_COOKIE_VALIDATION_KEY' => 'dcX23CGxzVlC7TZu_BSL1uPbwYngFRH1',
'ADMIN_EMAIL' => 'admin@yii2-starter-kit.localhost',
'GITHUB_CLIENT_ID' => 'your-client-id',
'GITHUB_CLIENT_SECRET' => 'your-client-secret',
];
$_COOKIE = [
'_locale' => '7da174d6a3fba2d2984618bfc44a806a8b4c14d99440370965606bdec9843b6ea:2:{i:0;s:7:"_locale";i:1;s:5:"en-US";}',
'PHPSESSID' => 'mkoe437muuaat3lus810147v03',
'_csrf' => 'f86f4cda6fa32f8ff87f3afade2799df92eed6386cd94f54ec47c5cc975d27c4a:2:{i:0;s:5:"_csrf";i:1;s:32:"KLYNZq4Dcpmm5tHVO1ylYRC4nrxKXFBH";}',
'_identity' => 'a1727827474024bfbee201f164d86434dfa7f1e2de7ff5b962ff923c58f55a28a:2:{i:0;s:9:"_identity";i:1;s:46:"[1,"mHqUDw8LqBJqdkJ7JreToXtNnPWsVBOO",2592000]";}',
];
$_SESSION = [
'__flash' => [],
'__id' => 1,
];
$_ENV = [
'YII_DEBUG' => 'true',
'YII_ENV' => 'dev',
'DB_DSN' => 'mysql:host=localhost;port=3306;dbname=noleggio',
'DB_USERNAME' => 'root',
'DB_PASSWORD' => '',
'DB_TABLE_PREFIX' => '',
'FRONTEND_URL' => 'http://localhost/yii2-starter-kit/frontend/web/',
'BACKEND_URL' => 'http://localhost/yii2-starter-kit/backend/web/',
'STORAGE_URL' => 'http://localhost/yii2-starter-kit/storage/',
'FRONTEND_COOKIE_VALIDATION_KEY' => 'dwmCa55rdn8OqXOVkiNU362Dutzx4pRT',
'BACKEND_COOKIE_VALIDATION_KEY' => 'dcX23CGxzVlC7TZu_BSL1uPbwYngFRH1',
'ADMIN_EMAIL' => 'admin@yii2-starter-kit.localhost',
'GITHUB_CLIENT_ID' => 'your-client-id',
'GITHUB_CLIENT_SECRET' => 'your-client-secret',
];
What’s the error message?
I was following the steps mentionned in the book Web Application Development with Yii 2 and PHP by Mark Safronov and had the exact same problem.
I got gii using composer require --prefer-dist "yiisoft/yii2-gii:*"; as mentionned in the book.
Thanks in advance for the help.
The error message is Undefined class constant ‘TYPE_DOUBLE’.
Hope this help
Which Yii version are you using? TYPE_DOUBLE is from master version of Gii. It could be used only with master version of Yii.
(un)fortunately i m not alone having this problem .that’s small comfort
in my case as descibed above i use this starter
trntv/yii2-starter-kit
kabinja yours ?
Hey,
Sorry for answering so late. I currently have Yii version 2.0.3 and I got it using composer require "yiisoft/yii2:*". I hope this respond to the question. Sorry I am still quite new to using Yii (and composer).
Cheers
So I managed to fix it by running again composer "yiisoft/yii2:*". It actually loaded some new stuff:
Updating yiisoft/yii2 dev-master (534d125 => 1ae2e4e)
Checking out 1ae2e4e908e591b27d9cdf3750a6a87436f731ca
Now it seems to be working just fine. Sorry for my unprecise answers, I am still new to the whole package management paradigm used with composer.
Cheers