Giix — Gii Extended a code generator for Yii PHP framework (scaffolding/code generation)
#161
Posted 13 February 2012 - 08:31 PM
i.e. GiixModel and GiixCrud don't work out of the box with each other (because GiixCrud uses $model->setAttributes($_POST['Column']) and without the validation rules, no columns of type Text are updated).
#162
Posted 14 February 2012 - 08:43 AM
ajberri, on 13 February 2012 - 08:31 PM, said:
Hi ajberri, please open a new ticket with all details so I can take a look at it.
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#163
Posted 15 February 2012 - 02:40 PM
I was wondering about the composite PK on the roadmap.
Will this be done "sometime soon" for CRUD?
If so, will it work for the existing yii code?
If not, what is the estimated effort for the average programmer to implement it?
have a nice day!
#164
Posted 16 February 2012 - 12:30 PM
yiivert, on 15 February 2012 - 02:40 PM, said:
Will this be done "sometime soon" for CRUD?
If so, will it work for the existing yii code?
If not, what is the estimated effort for the average programmer to implement it?
Hi yiivert,
There's no plan to have complete support for composite PK. Also, I can't estimate the effort it would take. You're welcome to check the source code and code this. giix source code is well documented. Then, if you want to contribute your work back to giix, I'll gladly take your patches.
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#165
Posted 21 February 2012 - 12:59 PM
I've got a question that's been asked before (on this thread too), but that I can't find the answer for. Can you post a working example of how to use the saveMultiple() function? I've figured out how to save a MANY-to-MANY, but can't find any examples of how to save a HAS_MANY or BELONGS_TO relationship.
In a hypothetical situation where I was updating a Comment view/model that also allowed updating the related BELONGS_TO Post for that comment, this is the code I've tried.
public function actionUpdate($id) {
$model = $this->loadModel($id, 'Comment');
if (isset($_POST['Comment'])) {
$model->setAttributes($_POST['Comment']);
$post = new Post();
$post->setAttributes($_POST['Post']);
$relatedData = array(
array(
'model' => $model,
'modelOptions' => array(
'attributes' => $_POST['Comment'],
),
),
array(
'model' => $post,
'modelOptions' => array(
'attributes' => $_POST['Post'],
),
),
);
if ($model->saveMultiple($relatedData)) {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
But everytime I try it, I get an error:
Fatal error: Using $this when not in object context in protected/extensions/giix-components/GxActiveRecord.php on line 578
Any suggestions? Thanks! Oh, by the way, I'm running GiiX 1.9.1
#166
Posted 24 February 2012 - 11:09 AM
Error 101 (net::ERR_CONNECTION_RESET)
i try cleaning assets and the content of the runtime folder but nothing happens, it still with the same error
please help, i love this ext
#167
Posted 24 February 2012 - 04:56 PM
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#168
Posted 24 February 2012 - 04:59 PM
fr0d0z, on 21 February 2012 - 12:59 PM, said:
Hi fr0d0z,
Unfortunately, saveMultiple has a few bugs that I just discovered. Please save the records manually.
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#170
Posted 27 February 2012 - 02:22 PM
I've installed giix and started using it. The GiixModel Generator works just great. But when I try to use the GiixCrud Generator I run into this:
1. I click on the Link "GiixCrud Generator" on the gii page (index.php?r=gii)
2. This opens up GiixCrud Generator page, but this page is broken. Only a few HTML lines are shown:
<h1>giix Crud Generator</h1> <p>This generator generates a controller and views that implement CRUD operations for the specified data model. </p> <div class="form gii"> <p class="note"> Fields with <span class="required">*</span> are required. Click on the <span class="sticky">highlighted fields</span> to edit them. </p><form id="yw0" action="/saja_cms/index.php?r=gii/giixCrud" method="post"> <div class="row"> <label for="GiixCrudCode_model" class="required">Model Class <span class="required">*</span></label>
There are no <head> tags, no css styling, no form is displad etc. Only what I've posted above. I've tested it on two different servers and run into the same problem.
Did anyone have this problem as well? I'm using the latests version of Yii (1.1.10).
Your help is very appreciated! I'd really like to use the crud functionality of giix, it would save me a lot of time.
Thanks for your help.
#173
Posted 05 March 2012 - 02:12 PM
Please remember that I can't support WAMP, xampp etc.
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#174
Posted 05 March 2012 - 03:29 PM
#175
Posted 05 March 2012 - 07:47 PM
I can (and want) take giix there, but I'm so busy with another project right now that we won't benefit much in the short term.
As soon as there's some space in the current project, giix will hit GitHub. I look forward to the community's pull requests
Meanwhile, you can post issues and patches to Google Code.
Thanks!
Check my extension
giix: a code generator for Yii.

The complete beginner's study guide for the Yii Framework
#176
Posted 06 March 2012 - 06:14 AM
I've been had the same issue as Nymphetamine, domo & TimLeary, with giixCrud giving browser error 101, (I'm also using WAMP), thought I should register on the forum to share my fix.
I've worked around the issue by editing extensions/giix-core/giixCrud/views/index.php to comment out the autocomplete input for model and replace with a normal text field:
<!-- <?php $form->widget('zii.widgets.jui.CJuiAutoComplete', array(
'model'=>$model,
'attribute'=>'model',
'source'=>$this->getModels(),
'options'=>array(
'delay'=>100,
'focus'=>'js:function(event,ui){
$(this).val($(ui.item).val());
$(this).trigger(\'change\');
}',
),
'htmlOptions'=>array(
'size'=>'65',
),
));
?> -->
<?php echo $form->textField($model,'model',array('size'=>65)); ?>My first guess would be the issue relates to the scandir function in getModels of GiixCrudGenerator, underscore in directory name is unusual for a windows system, maybe it's the _base folder but that's just a guess I don't really have time to investigate further.
Hope that helps.
#177
Posted 19 March 2012 - 04:29 AM
Before Giix I was using a class extending CActiveRecordBehavior and it was working, but now I can't make it to work with Giix..
Can you help me out?
This is my DBLog.php in the folder components
<?php
class DBLog extends CActiveRecordBehavior {
public function afterSave($event) {
if (!$this->Owner->isNewRecord) {
$log = new Log;
$log->id_user = Yii::app()->user->id;
$log->id_model = $this->Owner->id;
$log->title = get_class($this->Owner);
$log->action = 'CHANGE';
$log->date = date("Y-m-d G:i:s",time());
$a=$log->save(false);
if (!$a) echo $a->getErrors();
} else {
$log = new Log;
$log->id_user = Yii::app()->user->id;
$log->id_model = $this->Owner->id;
$log->title = get_class($this->Owner);
$log->action = 'CREATE';
$log->date = date("Y-m-d G:i:s",time());
$a=$log->save(false);
if (!$a) echo $a->getErrors();
}
}
public function afterDelete($event) {
$log = new Log;
$log->id_user = Yii::app()->user->id;
$log->id_model = $this->Owner->id;
$log->title = get_class($this->Owner);
$log->action = 'DELETE';
$log->date = date("Y-m-d G:i:s",time());
$a=$log->save(false);
if (!$a) echo $a->getErrors();
}
}
?>
#178
Posted 19 March 2012 - 09:31 AM
Nymphetamine, on 24 February 2012 - 11:09 AM, said:
Error 101 (net::ERR_CONNECTION_RESET)
i try cleaning assets and the content of the runtime folder but nothing happens, it still with the same error
please help, i love this ext
HI there.. Im experiencing the same problem, did you find a solution for this?
#179
Posted 26 March 2012 - 03:51 PM
TimLeary, on 05 March 2012 - 02:04 PM, said:
i confirm it's a wamp problem, i try withe firefox,chrome, IE , start / stop wamp ... no success
so i've download UwAmp, with the same code ... no error !!
it's definitly a wamp problem
#180
Posted 26 March 2012 - 04:08 PM
I don't understand why Giix use checkbox in the _form, it's works so better with a multi select ...
for that i've modified the :
"protected\extensions\giix-core\giixCrudGiixCrudCode.php"
around line 144 :
replace :
return "echo \$form->checkBoxList(\$model, '{$relationName}', GxHtml::encodeEx(GxHtml::listDataEx({$relationModel}::model()->findAllAttributes(null, true)), false, true))";
with :
return "echo \$form->listBox(\$model, '{$relationName}', GxHtml::encodeEx(GxHtml::listDataEx({$relationModel}::model()->findAllAttributes(null, true)), false, true),array('multiple'=>'multiple'))";
it work with multiselect, saved and all fine, it's required ....
The only problem is i get a php notice on the controler
just after each action i need to manually make a :
if (!isset($_POST['XXX']['YYY']))
$_POST['XXX']['YYY']='';
for information i've searched to translate the message :
1°: create protected\messages\fr\app.php
2°: copy the structure of yii\framework\messages\fr\yii.php
3°: enjoy the Giix Multilanguage !
ps : i'm french sorry for mistakes
This post has been edited by gaspine: 26 March 2012 - 04:20 PM

Help














