Yii Framework Forum: Giix — Gii Extended - Yii Framework Forum

Jump to content

  • (14 Pages)
  • +
  • « First
  • 7
  • 8
  • 9
  • 10
  • 11
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Giix — Gii Extended a code generator for Yii PHP framework (scaffolding/code generation) Rate Topic: ***** 4 Votes

#161 User is offline   Artificial 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 11-December 10
  • Location:Sydney, Australia

Posted 13 February 2012 - 08:31 PM

Perhaps this is a bug? When I generate Models using Giix it doesn't seem to add any validation rules for columns of type text, meaning I have to manually add those rules in to the model in order to pass validation methods.

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).
0

#162 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 14 February 2012 - 08:43 AM

View Postajberri, on 13 February 2012 - 08:31 PM, said:

Perhaps this is a bug? When I generate Models using Giix it doesn't seem to add any validation rules for columns of type text, meaning I have to manually add those rules in to the model in order to pass validation methods.)


Hi ajberri, please open a new ticket with all details so I can take a look at it.
0

#163 User is offline   yiivert 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 15-February 12

Posted 15 February 2012 - 02:40 PM

Hi,
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!
0

#164 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 16 February 2012 - 12:30 PM

View Postyiivert, on 15 February 2012 - 02:40 PM, said:

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?


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.
0

#165 User is offline   acorncom 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 100
  • Joined: 25-February 11
  • Location:CO, USA

Posted 21 February 2012 - 12:59 PM

Hello. First off, thanks very much for this extension to Gii. It's saved me tons of time already.

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
0

#166 User is offline   Nymphetamine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 13-January 12

Posted 24 February 2012 - 11:09 AM

I have a problem with giix, i reinstall mysql, php and apache services, and now i have a problem with the giix crud generator , it is not opening, but its so weird because the giix model generator works fine, the error in the navigator is:

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
0

#167 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 24 February 2012 - 04:56 PM

Very strange. Please open a new ticket with all the information asked there. Thanks!
0

#168 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 24 February 2012 - 04:59 PM

View Postfr0d0z, on 21 February 2012 - 12:59 PM, said:

Can you post a working example of how to use the saveMultiple() function?


Hi fr0d0z,

Unfortunately, saveMultiple has a few bugs that I just discovered. Please save the records manually.
0

#169 User is offline   acorncom 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 100
  • Joined: 25-February 11
  • Location:CO, USA

Posted 24 February 2012 - 05:29 PM

View Postmentel, on 24 February 2012 - 04:59 PM, said:

Hi fr0d0z,

Unfortunately, saveMultiple has a few bugs that I just discovered. Please save the records manually.


Thanks mentel, that's what I'm doing for now. But thanks again for GiiX, it's saving me tons of time.
0

#170 User is offline   domo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 27-February 12

Posted 27 February 2012 - 02:22 PM

First of all, thanks a lot for this very usefull extension!! I'm new to Yii, so please forgive me if I'm bothering you with this (if it should not be a bug...)

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.
0

#171 User is offline   TimLeary 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 02-March 12

Posted 02 March 2012 - 02:36 PM

View Postmentel, on 24 February 2012 - 04:56 PM, said:

Very strange. Please open a new ticket with all the information asked there. Thanks!


Hi!
I've the same problem with GiixCrud.(The browser run to ERROR :: 101.) I use new WAMP with a 'virgin' yii and sql shema.
0

#172 User is offline   TimLeary 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 02-March 12

Posted 05 March 2012 - 02:04 PM

View PostTimLeary, on 02 March 2012 - 02:36 PM, said:

Hi!
I've the same problem with GiixCrud.(The browser run to ERROR :: 101.) I use new WAMP with a 'virgin' yii and sql shema.


With xampp there is no problem with it. Maybe it 'couse WAMP permissions.
0

#173 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 05 March 2012 - 02:12 PM

If you find new issues, please open a new detailed ticked.
Please remember that I can't support WAMP, xampp etc.
0

#174 User is offline   acorncom 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 100
  • Joined: 25-February 11
  • Location:CO, USA

Posted 05 March 2012 - 03:29 PM

Rodrigo, any chance you might be moving GiiX to Github at some point? With the change of Yii to Github, it might be easier for us to submit pull requests to you if you were using Github as well. Just a thought.
0

#175 User is offline   Rodrigo Coelho 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 665
  • Joined: 05-August 10
  • Location:Rio de Janeiro, Brazil

Posted 05 March 2012 - 07:47 PM

Yes, it will. It is planned already.

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!
0

#176 User is offline   altPro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-March 12

Posted 06 March 2012 - 06:14 AM

Just started experimenting with Yii and found the excellent Giix, great work!

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.
0

#177 User is offline   chumbx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 26-January 12

Posted 19 March 2012 - 04:29 AM

How can you do a LOG for every action done in the database?
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();
    }

}

?>


0

#178 User is offline   iScotts 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 31-January 12

Posted 19 March 2012 - 09:31 AM

View PostNymphetamine, on 24 February 2012 - 11:09 AM, said:

I have a problem with giix, i reinstall mysql, php and apache services, and now i have a problem with the giix crud generator , it is not opening, but its so weird because the giix model generator works fine, the error in the navigator is:

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?
0

#179 User is offline   gaspine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-March 12

Posted 26 March 2012 - 03:51 PM

View PostTimLeary, on 05 March 2012 - 02:04 PM, said:

With xampp there is no problem with it. Maybe it 'couse WAMP permissions.

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
0

#180 User is offline   gaspine 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-March 12

Posted 26 March 2012 - 04:08 PM

i want to create another another post, speaking of many/many realtion.

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

0

Share this topic:


  • (14 Pages)
  • +
  • « First
  • 7
  • 8
  • 9
  • 10
  • 11
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users