schmunk42 / yii2-giiant Goto Github PK
View Code? Open in Web Editor NEWYii 2 Framework Code Generator Gii on Steroids
Yii 2 Framework Code Generator Gii on Steroids
i want to use Providers but I can't follow the instruccions from Readme.md. I think this happens to me because i'm new at yii2.
Can you give me some details?
When you say: "Configure providers, add this to your provider list in the form:". What is form?
And when you say "And configure the settings of the provider:"? Which file i have to modify?
Note: i found in yiisoft/yii2/CHANGELOG.md Yii::$objectConfig
is removed. You should use Yii::$container->set()
to configure default settings of classes. (qiangxue)
Thak you in advance!
On running the batch controller index action getting the following error
Running batch...
Error: Unknown command "giic/giiant-model".
L93: BatchController calling giic/giiant-model action
\Yii::$app->runAction(ltrim($route, '/'), $params);
Not sure If am looking incorrectly, but there does not seems be any such action
Hi... a usefull option would be to be able to override templates
Could be done with a fix for yiisoft/yii2#5687 and yiisoft/yii2#5224
Hi,
After using giiant a couple of times, I end up using the RelationProvider which is great (at least for one to many relation as of now...)
However, I had a small concern because the values displayed in the dropdown field were sorted by their primary key (id in my case). In most of the case, I guess that people would like it to be sorted by displayed name (name in my case).
I end up modifying the crud/providers/RelationProvider.php file on the line 27 with
\yii\helpers\ArrayHelper::map({$relation->modelClass}::find()->orderBy('{$name}')->all(),'{$pk}','{$name}'),
In my case it makes most of the time more sense to do so, whats your point of view?
if no view path is set no views will be generated . It would be nice to set it as required Field
When you try to log in Giiant CRUD generator:
PHP User Error – yii\base\ErrorException
Exception (Unknown Property) 'yii\base\UnknownPropertyException' with message 'Getting unknown property: schmunk42\giiant\crud\Generator::moduleID'
in /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/Component.php:143
Stack trace:
#0 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/helpers/BaseHtml.php(1838): yii\base\Component->__get('moduleID')
#1 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/helpers/BaseHtml.php(1139): yii\helpers\BaseHtml::getAttributeValue(Object(schmunk42\giiant\crud\Generator), 'moduleID')
#2 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/helpers/BaseHtml.php(1160): yii\helpers\BaseHtml::activeInput('text', Object(schmunk42\giiant\crud\Generator), 'moduleID', Array)
#3 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/widgets/ActiveField.php(177): yii\helpers\BaseHtml::activeTextInput(Object(schmunk42\giiant\crud\Generator), 'moduleID', Array)
#4 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/widgets/ActiveField.php(149): yii\widgets\ActiveField->render()
#5 /var/www/avtopoch.apronim.io/www/advanced/vendor/schmunk42/yii2-giiant/crud/form.php(12): yii\widgets\ActiveField->__toString()
#6 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/View.php(325): require('/var/www/avtopo...')
#7 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/View.php(247): yii\base\View->renderPhpFile('/var/www/avtopo...', Array)
#8 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2-gii/views/default/view.php(38): yii\base\View->renderFile('/var/www/avtopo...', Array)
#9 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/View.php(325): require('/var/www/avtopo...')
#10 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/View.php(247): yii\base\View->renderPhpFile('/var/www/avtopo...', Array)
#11 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/View.php(149): yii\base\View->renderFile('/var/www/avtopo...', Array, Object(yii\gii\controllers\DefaultController))
#12 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/Controller.php(367): yii\base\View->render('view', Array, Object(yii\gii\controllers\DefaultController))
#13 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2-gii/controllers/DefaultController.php(56): yii\base\Controller->render('view', Array)
#14 [internal function]: yii\gii\controllers\DefaultController->actionView('giiant-crud')
#15 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#16 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#17 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('view', Array)
#18 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('gii/default/vie...', Array)
#19 /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#20 /var/www/avtopoch.apronim.io/www/advanced/backend/web/index.php(18): yii\base\Application->run()
#21 {main}
in /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/ErrorHandler.php at line 233
224225226227228229230231232233234235236237238239240241242 /**
__toString()
/**
yii\base\ErrorHandler::handleError(256, 'Exception (Unknown Property) 'yi...', '/var/www/avtopoch.apronim.io/www...', 233, ...)
in /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/ErrorHandler.php – trigger_error('Exception (Unknown Property) 'yi...', 256) at line 233
in /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/widgets/ActiveField.php – yii\base\ErrorHandler::convertExceptionToError(yii\base\UnknownPropertyException) at line 151
in /var/www/avtopoch.apronim.io/www/advanced/vendor/schmunk42/yii2-giiant/crud/form.php – yii\widgets\ActiveField::__toString() at line 12
6789101112131415161718 */
echo $form->field($generator, 'modelClass');
echo $form->field($generator, 'searchModelClass');
echo $form->field($generator, 'controllerClass');
echo $form->field($generator, 'baseControllerClass');
echo $form->field($generator, 'moduleID');
echo $form->field($generator, 'viewPath');
echo $form->field($generator, 'pathPrefix');
echo $form->field($generator, 'indexWidgetType')->dropDownList(
[
'grid' => 'GridView',
'list' => 'ListView',
6. in /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/View.php – require('/var/www/avtopoch.apronim.io/www...') at line 325
7. in /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2/base/View.php – yii\base\View::renderPhpFile('/var/www/avtopoch.apronim.io/www...', ['generator' => schmunk42\giiant\crud\Generator, 'form' => yii\widgets\ActiveForm]) at line 247
8. in /var/www/avtopoch.apronim.io/www/advanced/vendor/yiisoft/yii2-gii/views/default/view.php – yii\base\View::renderFile('/var/www/avtopoch.apronim.io/www...', ['generator' => schmunk42\giiant\crud\Generator, 'form' => yii\widgets\ActiveForm]) at line 38
32333435363738394041424344 ]); ?>
return $this->render('view', $params);
}
public function actionPreview($id, $file)
{
$generator = $this->loadGenerator($id);
if ($generator->validate()) {
$application = new yii\web\Application($config);
$application->run();
$_GET = [
'r' => 'gii/default/view',
'id' => 'giiant-crud',
];
$SERVER = [
'HTTP_HOST' => 'avtopoch.apronim.io',
'HTTP_CONNECTION' => 'keep-alive',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/_;q=0.8',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36',
'HTTP_DNT' => '1',
'HTTP_REFERER' => 'http://avtopoch.apronim.io/advanced/backend/web/index.php?r=gii%2Fdefault%2Fview&id=giiant-model',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, sdch',
'HTTP_ACCEPT_LANGUAGE' => 'ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4',
'HTTP_COOKIE' => 'dle_user_id=1; dle_password=70fce4c199805e5b8e703176bd8c0dd4; dle_compl=0; dle_newpm=0; member_id=1; PHPSESSID=f0d3e78l9853vreu91gtgr8qa7; _csrf=7154364cc64ec598bc12b5f78d4fbf44c12a7148f0029ddbd1694011a47f9b52s%3A32%3A%22dC31l-UicmOOYm-HO5lg7Uocmh6v0CSp%22%3B',
'PATH' => '/usr/local/bin:/usr/bin:/bin',
'SERVER_SIGNATURE' => '
Apache/2.2.16 (Debian) Server at avtopoch.apronim.io Port 80
',
'SERVER_SOFTWARE' => 'Apache/2.2.16 (Debian)',
'SERVER_NAME' => 'avtopoch.apronim.io',
'SERVER_ADDR' => '195.211.103.208',
'SERVER_PORT' => '80',
'REMOTE_ADDR' => '146.185.187.152',
'DOCUMENT_ROOT' => '/var/www/avtopoch.apronim.io/www',
'SERVER_ADMIN' => 'webmaster@localhost',
'SCRIPT_FILENAME' => '/var/www/avtopoch.apronim.io/www/advanced/backend/web/index.php',
'REMOTE_PORT' => '30744',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'REQUEST_METHOD' => 'GET',
'QUERY_STRING' => 'r=gii%2Fdefault%2Fview&id=giiant-crud',
'REQUEST_URI' => '/advanced/backend/web/index.php?r=gii%2Fdefault%2Fview&id=giiant-crud',
'SCRIPT_NAME' => '/advanced/backend/web/index.php',
'PHP_SELF' => '/advanced/backend/web/index.php',
'REQUEST_TIME_FLOAT' => 1418261101.9960001,
'REQUEST_TIME' => 1418261101,
];
$_COOKIE = [
'dle_user_id' => '1',
'dle_password' => '70fce4c199805e5b8e703176bd8c0dd4',
'dle_compl' => '0',
'dle_newpm' => '0',
'member_id' => '1',
'PHPSESSID' => 'f0d3e78l9853vreu91gtgr8qa7',
'_csrf' => '7154364cc64ec598bc12b5f78d4fbf44c12a7148f0029ddbd1694011a47f9b52s:32:"dC31l-UicmOOYm-HO5lg7Uocmh6v0CSp";',
];
Yii Framework
2014-12-11, 04:25:02
Apache/2.2.16 (Debian)
Yii Framework/2.0.1
Scenario:
table = 'app_file',
fields:'id',name_id,'path'
Now i added in the Model File not FileBase
/**
* @var the file
*/
public $file;
/**
* file to upload
* @inheritdoc
*/
public function rules()
{
return array_merge(parent::rules(),[
['file', 'file', 'types' => 'jpg,png,gif,mp4,pdf', 'skipOnEmpty' => false],
]);
}
PHP Notice 'yii\base\ErrorException' with message 'Undefined index: file'
because its not in tableShema its only a public var
While previewing the generated code it only seems to be able to display the first model. Ift just looks like each model you are going to generate is a copy of whatever the first model is.
Jonny
I really appreciate your extension. It has worked great from me until I came upon a situation involving a pivot table relationship. The specific error that it's throwing is: Calling unknown method: app\models\CrochetPattern::get{crochetPatternTag}s(). It looks like extraneous characters (the braces) are being thrown into the method name and that the name is being inflected when it shouldn't. There is a app\models\CrochetPattern::getCrochetPatternTags() method in the appropriate model. Rather than trying to explain everything here, I'm attaching a jpg with the ERD and a copy of the stack trace leading up to the error. (Actually, I'm mystified why Github won't let me attach a .txt file and forces me to turn the trace into a much larger jpg.)
Hope that helps.
after install via composer and setup everything looks fine so far.
need to use table prefix in my db (provider),
just didn't find any config docs in giiant and generating with "tbl_*" gives me
models with "TblTableName" where "TableName" is suggested
When add a new base model all properties phpdoc tags are not related to namespaces classes.
For example
@property Order[] $orders
should be
@property \common\models\Order[] $orders
could this class be set via config?
Yii2 Guide section for Gii.
above is a dead link now!
yii2 doc has changed recently
see here:
http://www.yiiframework.com/doc-2.0/guide-tool-gii.html
I don't guess this is an easy one... - maybe this can be fixed over the "id" which is available in all records...
PHP Notice 'yii\base\ErrorException' with message 'Trying to get property of non-object'
in /app/vendor/schmunk42/yii2-giiant/crud/providers/DateProvider.php:10
the reason is it's looking for $attribute->name
but $attribute
is a string containing id
With Giix, it created a series of base models and also standard models that inherited from the base models. This meant that if there were changes to your DB schema you could just re-run the Giix model generator and it would overwrite the base models with the new schema meaning you didn't run the risk of accidently overwriting your methods in the model. Is this a possibility for Giiant?
Thanks
Jonny
Hi,
in views/index.php:
if ($rel = $model->getUser()->one()) {
return yii\helpers\Html::a($rel->id, ["user/view", 'id' => $rel->id,], ["data-pjax" => 0]);
route user/view is not working (yii2-user installed). What else do I have to adjust to make it work? Thanks!
Thought you'd like to know. I just updated giiant, and where it was working before, now I get this error message:
PHP Strict Warning – yii\base\ErrorException
Declaration of schmunk42\giiant\model\Generator::generateClassName() should be compatible with yii\gii\generators\model\Generator::generateClassName($tableName, $useSchemaName = NULL)
bitte melde dich bei Interesse unter philipp at frenzel net
Is it possible to combine giiant with https://github.com/2amigos/yii2-translate-behavior
So the crud creates fields from the *_lang table for all languages.
When a controller is generated the create action is handled in a try/catch statement and all caught exceptions are stored as user input error. Is there any specific reason this is handled that way. I am concerned about the security implications this might have!
Thx
Seems the preferred way to define scopes is via an ActiveQuery class:
yiisoft/yii2#2016
This is what the Gii model generator creates:
<?php
namespace app\models\query;
/**
* This is the ActiveQuery class for [[\app\models\Job]].
*
* @see \app\models\Job
*/
class Job extends \yii\db\ActiveQuery
{
/*public function active()
{
$this->andWhere('[[status]]=1');
return $this;
}*/
/**
* @inheritdoc
* @return \app\models\Job[]|array
*/
public function all($db = null)
{
return parent::all($db);
}
/**
* @inheritdoc
* @return \app\models\Job|array|null
*/
public function one($db = null)
{
return parent::one($db);
}
}
Should giiant create the same when creating models?
What do you think about generating constants one for each attribute name for facilitate faster reference in query strings such as
BaseModel.php:
const CUSTOMER_USERNAME='username'
in query where clause later
$model->where([BaseModel::CUSTOMER_USERNAME => 'admin'])
The idea is you don't need to remember the AR attr name but as soon as you type BaseModel:: and you get the constants autosuggested for you. It may accelerate coding this way. You don't have to switch between model files to copy the exact attribute name!
just an idea...
I've been scratching my head for a bit wondering why my show view returned an empty result set (and thus raising an UnknownPropertyException
on the $model object.
It appears that this line (Class::find($id)
) does not send an sql request (and also does not return null) until the method one
is called on it like so:
Class::find($id)->one()
I'm trying to generate a CRUD from a model using the giiant CRUD generator, but when I do so, I get the following error:
'yii\base\InvalidParamException' with message 'Invalid path alias: @backend/views' in C:\php\medexpenses\vendor\yiisoft\yii2\BaseYii.php:152
The stack trace is as follows:
#0 C:\php\medexpenses\vendor\schmunk42\yii2-giiant\crud\Generator.php(175): yii\BaseYii::getAlias('@backend/views') #1 C:\php\medexpenses\vendor\yiisoft\yii2-gii\generators\crud\Generator.php(166): schmunk42\giiant\crud\Generator->getViewPath() #2 C:\php\medexpenses\vendor\yiisoft\yii2-gii\controllers\DefaultController.php(45): yii\gii\generators\crud\Generator->generate() #3 [internal function]: yii\gii\controllers\DefaultController->actionView('giiant-crud') #4 C:\php\medexpenses\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array) #5 C:\php\medexpenses\vendor\yiisoft\yii2\base\Controller.php(151): yii\base\InlineAction->runWithParams(Array) #6 C:\php\medexpenses\vendor\yiisoft\yii2\base\Module.php(455): yii\base\Controller->runAction('view', Array) #7 C:\php\medexpenses\vendor\yiisoft\yii2\web\Application.php(83): yii\base\Module->runAction('gii/default/vie...', Array) #8 C:\php\medexpenses\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request)) #9 C:\php\medexpenses\web\index.php(12): yii\base\Application->run() #10 {main}
I've only just installed giiant this afteroon using Composer, so perhaps I missed a configuration step.
Any ideas?
Your instructions only address the installation using the Basic template while I am using the Advanced template. Will this extension work with the Advanced template? I've added the following to frontend/config/main.php:
'modules' => [
'gii' => [
'class' => 'yii\gii\Module',
'generators' => [
'giiant-crud' => ['class' => 'schmunk42\giiant\crud\Generator'],
'giiant-model' => ['class' => 'schmunk42\giiant\model\Generator'],
]
],
...
However, when I go to /gii, the only option that appears within the Code Template dropdown is the native \vendor\yiisoft\yii2-gii template, for both Model and CRUD. I've also tried placing it in common/config/main.php, and the result is the same.
How do I get the option for this set of templates to show up?
In the docs on the home page
$config['modules']['gii'] = array();
$config['modules']['gii']['class'] = 'yii\gii\Module';
$config['modules']['gii']['generators'] = [
'giiant-crud' => ['class' => 'schmunk42\giiant\crud\Generator']
'giiant-model' => ['class' => 'schmunk42\giiant\model\Generator'],
];
Should there be a comma after this line, my editor complained
'giiant-crud' => ['class' => 'schmunk42\giiant\crud\Generator']
namespace <?= $generator->ns ?>;
use Yii;
use \<?= $generator->ns ?>\base\<?= $className ?> as Base<?= $className ?>;
/**
* This is the model class for table "<?= $tableName ?>".
*/
class <?= $className ?> extends Base<?= $className . "\n" ?>;
{
}
Hi,
Thanks Philipp (generating code) :)
Hi,
I finally figured out why I wasn't able to make this promising extension working with my yii2 setup.
It seems that the below code from the readme file is incorrect:
"And configure the settings of the provider, add setting via dependecy injection this to your application config, eg. in console/config/bootstrap.php:"
\Yii::$container->set(
'schmunk42\giiant\crud\providers\EditorProvider',
[
'columnNames' => ['description']
]
);
should be
\Yii::$container->set(
'\schmunk42\giiant\crud\providers\EditorProvider',
[
'columnNames' => ['description']
]
);
There is one backslash missing at the beginning of the namespace...
Cheers
If i use a subfolder like /crud/GController the relation on the Grid in index.php creates wrong link without "crud"
Exception 'yii\base\UnknownPropertyException' with message 'Getting unknown property: schmunk42\giiant\crud\Generator::gridMaxColumns'
Not work if (++$count < $generator->gridMaxColumns)
Hi,
after generating code with Giiant CRUD, I get this error message when trying to reach controller: Unknown Property – yii\base\UnknownPropertyException Getting, unknown property: common\models\User::isAdmin
When I comment this out:
'matchCallback' => function() use ($permission) {
return \Yii::$app->user->can($permission) || (\Yii::$app->user->identity && \Yii::$app->user->identity->isAdmin);
},
it seems to work. What is the problem here? Thx!
Hi,
I have made a completely new install off yii2, than yii2-user (here I'm not sure if I must migrate or not, and if I have to do this or not: "Make sure that you don't have user component configuration in your config files" - the doc is not 100% clear), than yii2-giiant.
When I generate the first model, with relation to user table, it creates the following relation:
public function getUser()
{
return $this->hasOne(\app\models\User::className(), ['id' => 'UserId']);
}
next, I want to generate Giiant-CRUD, and get the following error:
PHP Fatal Error – yii\base\ErrorException Class 'app\models\User' not found
I think relation should point to some other model (model of yii2-user in vendor\dektrium\yii2-user\models\User.php), or not? Or is there something wrong with yii2-user extension, and that's why it doesn't work? I have no clue.
Thanks!
What about option to generate basic model/controller tests?
I think, in views/index.php in the grid, related attribute should be:
if ($rel = $model->getUser()->one()) {
instead of this:
if ($rel = $model->getUserId()->one()) {
right...?
Thanks!
I am having an issue when generating CRUD for a many-to-many relationship. I have two models, Empresa and Regimen, and one table to join them together (for which I have no model since is just a glue table).
When I try to use Giiant CRUD, I get the error:
Unknown Method – yii\base\UnknownMethodException
Calling unknown method: backend\models\Regimen::getEmpresaRegimens()
Which is a method that calls the model EmpresaRegimen that doesn't exist. As far as I am concerned with standards, glue tables like that (only empresa_id and regimen_id being the fields) should not have model file. Or am I wrong in such interpretation?
Anyhow, even if I change the code in the base model from getEmpresaRegimens to the next function,
public function getEmpresas(){
return $this->hasMany(\common\models\Empresa::className(), ['id' => 'empresa_id'])->viaTable('empresa_regimen', ['regimen_id' => 'id']);
}
the error of the relationship still appears, asking for the same getEmpresaRegimens function. After eliminating the function getEmpresas()
the generator works, albeit it doesn't build the relationship. My question is, is my relationship code or the lack of glue model wrong? or is a problem of the generator?
Regards.
Hi, I've noticed a strange behaviour with Model Class field when trying to generate Giiant Model. It's required to type something into Model Class field, but it doesn't matter what you type. The name will be equal to table name anyway. I don't know if it was meant to be to behave like this, but I don't think so. Thx!
By default, the currently generated crud makes it possible for anyone to create, read, update and delete anything in the database.
PHP User Error – yii\base\ErrorException
Exception (Unknown Property) 'yii\base\UnknownPropertyException' with message 'Getting unknown property: schmunk42\giiant\crud\Generator::moduleID'
in /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/Component.php:143
Stack trace:
#0 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/helpers/BaseHtml.php(1838): yii\base\Component->__get('moduleID')
#1 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/helpers/BaseHtml.php(1139): yii\helpers\BaseHtml::getAttributeValue(Object(schmunk42\giiant\crud\Generator), 'moduleID')
#2 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/helpers/BaseHtml.php(1160): yii\helpers\BaseHtml::activeInput('text', Object(schmunk42\giiant\crud\Generator), 'moduleID', Array)
#3 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/widgets/ActiveField.php(177): yii\helpers\BaseHtml::activeTextInput(Object(schmunk42\giiant\crud\Generator), 'moduleID', Array)
#4 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/widgets/ActiveField.php(149): yii\widgets\ActiveField->render()
#5 /private/var/www/xxx.xxx/vendor/schmunk42/yii2-giiant/crud/form.php(12): yii\widgets\ActiveField->__toString()
#6 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/View.php(325): require('/private/var/ww...')
#7 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/View.php(247): yii\base\View->renderPhpFile('/private/var/ww...', Array)
#8 /private/var/www/xxx.xxx/vendor/yiisoft/yii2-gii/views/default/view.php(38): yii\base\View->renderFile('/private/var/ww...', Array)
#9 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/View.php(325): require('/private/var/ww...')
#10 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/View.php(247): yii\base\View->renderPhpFile('/private/var/ww...', Array)
#11 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/View.php(149): yii\base\View->renderFile('/private/var/ww...', Array, Object(yii\gii\controllers\DefaultController))
#12 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/Controller.php(367): yii\base\View->render('view', Array, Object(yii\gii\controllers\DefaultController))
#13 /private/var/www/xxx.xxx/vendor/yiisoft/yii2-gii/controllers/DefaultController.php(56): yii\base\Controller->render('view', Array)
#14 [internal function]: yii\gii\controllers\DefaultController->actionView('giiant-crud')
#15 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#16 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#17 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('view', Array)
#18 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/web/Application.php(83): yii\base\Module->runAction('gii/default/vie...', Array)
#19 /private/var/www/xxx.xxx/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#20 /private/var/www/xxx.xxx/backend/web/index.php(18): yii\base\Application->run()
#21 {main}
in vendor/schmunk42/yii2-giiant/crud/Generator.php
public $moduleID;
line 123 change to
'relations' => isset($relations[$tableName]) ? $relations[$tableName] : [],
Hi again,
I notice that when I'm using the Giiant Model generator, the Model Class field seems not to be used to define the class name and the file name.
In my case, I name the table Countries in my database but would like to get the model generated called Country. I fill the generator form with
Table Name = Counties
Model Name = Country
But the generator keeps creating CountriesBase and Countries files and classes.
I looked into the code and I fix the issue by addiing:
if (isset($this->classNames[$tableName])) {
return $this->classNames[$tableName];
}
at the beginning of the function
protected function generateClassName($tableName)
in the file yii2-giiant/model/Generator.php
Actually I get this piece of code from the yii2-gii generator and I notice that you renamed classNames to classNames2. I didin't dare to touch what you did so I just add my three lines of code.
Any better solution?
the gii can determine the right path of the crud views .but giiant seems perform a wrong action !
even though i use this extension in yii2(i rewrite it for yii2):
WebApplicationEndBehavior
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.