Jump to content
Larry Ullman's Book Forums
Jonathon

Giix Extension

Recommended Posts

Hi Larry,

 

I was wondering if (When you get a spare minute). If you could let me know your experiences with the Giix extension. I read about it in your book and it seemed really helpful. However this is the first time i've used Yii so I wondered if any changes it creates in comparison to regular Gii might be hard to pick up for someone new to Yii like me, some of the methods seem to change to things like "GxActiveForm" for instance. I liked what you and it has to say about better handling of related tables as I do have a lot on related tables. And from reading between the lines it seems that if you make changes to your DB after you start it would be easier to update the code.

 

Thanks

 

Jonathon

Share this post


Link to post
Share on other sites

Hey Jonathon,

 

I'm not sure I have too much to add beyond what I say in the book. I like much of what Giix does, especially for beginners and especially with relations. I also like the approach it puts forth: customizing the Gii-generated code to suit the way you want things done. It's fantastic that Yii (Gii) creates all the code for you, but you don't have to just accept that code as it is, either.

Share this post


Link to post
Share on other sites

I'm having a look at the Giix extension. I just made another copy of my practice site and renamed it. I notice the code is very similar in places. Just wanted to check over a couple of things. I notice it doesn't list a postOnly + delete in the filter, but in the actionDelete code it states

 

	public function actionDelete($id) {
		if (Yii::app()->getRequest()->getIsPostRequest()) {
			$this->loadModel($id, 'Item')->delete();

			if (!Yii::app()->getRequest()->getIsAjaxRequest())
				$this->redirect(array('admin'));
		} else
			throw new CHttpException(400, Yii::t('app', 'Your request is invalid.'));
	}

 

Does if (Yii::app()->getRequest()->getIsPostRequest()). Basically mean the same as the filter. It would appear so.

 

Also noted that in the Giix version of a controller it uses the $model->setAttributes=$_POST['Item']; where as the standard Gii method uses  $model->attributes=$_POST['Item'];. 

 

I wondered why the slight difference. I looked at the framework notes for this but couldn't really understand the difference in the two methods. Other than the setAttributes method does seem to clearly defined as a setter. 

 

Other than that the controllers are very similar for those interested. I shall have to have a play with using data and related tables.

 

Jonathon

Share this post


Link to post
Share on other sites

I have been using the giix extension for a couple of months now. I have been making a lot of table schema changes during development, and the fact that giix splits the model into a base part and a localized part is extremely helpful. When the model changes, such as adding a foreign key pointing to that table, rebuild the base model without touching your code.

 

Be VERY careful when re-generating model or CRUD code! Be sure you preview everything, item by item, to ensure you don't overwrite something you meant to keep. In the views, I often copy-and-paste from the "diff" preview into my existing edited file to pick up the new or changed field/relationship.

 

Ed Barnard

Share this post


Link to post
Share on other sites

Thanks again for sharing, Ed. Version control will help in these situations, of course, or just copying the existing directory somewhere else before making changes. 

Share this post


Link to post
Share on other sites

Okay I'm still going through the book and I LOVED the Booster plugin but I don't get the Giix plugin at all.

 

I installed it and ran the giix model and giix crud for tables that are related but the code generated for my one model doesn't even show the admin page.  It's just a blank white screen!

 

I look for documentation on how to use the features of this extension and there isn't any!  Just issues.

 

What am I missing.  I can't see supporting an extension that doesn't help you figure out what you can do with it.

 

MANY_MANY relationships with lookup tables are my freaking nemesis.  I can't figure out how to use Yii to work with them easily.

Share this post


Link to post
Share on other sites

Just to be clear, you're using a Yii2 version of Giix? Could you confirm the Yii version and where you downloaded Giix from? Also, is display_errors enabled or are you seeing errors in your server logs?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...