Giix — Gii Extended

Thanks for a fast reply!

I really need to try all features of giix, once again great extension :)

Hey, thank you for the extension. I’m loving it!

I’m working on the templates for generating haml views based on giix crud templates. I’ve set up a repo on github with the code. As I’m new to the forum I can’t post links :confused: (it really sucks) but you can figure this will do: github.com/svallory/giix-haml

I’ve changed the rendered structure to add semantics and will provide a basic stylesheet to adjust it to the basic yii template look and feel.

cheers,

Saulo

Hi Saulo, I saw your PM too.

That’s sweet!

I have good news for you: giix will have its own extension repository. Your template + generator can be there.

What do you think about it?

And thanks for your contribution and kind words :)

That’s awesome! Just let me know when it comes out and I’ll pack and post it there.

Have you thinked about using github over google code? I noticed most of people here use google code. I’m not a git fanatic I just think it’s much easier for people to colaborate. For example, if giix was on github, I would send you a pull request, you could review it and, if you wanted, pull it easily to your repository right now.

I think the ‘commit access’ is a great barrier to contributors.

Yes.

giix should be moved there when Yii is, too (planned to version 2).

Thank you!

Guys, you are awesome.

A few days ago I saw that giix is currently ranking first as the most upvoted extension for Yii!

I’d like to thank you very much for your feedback :)

giix 1.9.1

And there is giix 1.9.1 (download here), with a fix for the issue #23. This issue was already fixed in the trunk, but I have decided to make this release until the new version is not ready.

Next…

And the version 2.0 is being carefully prepared. Stay tuned!

Hello

At the beginning: sorry for my English.

I am a novice when it comes to yii, gii and giix. I’v read almost everything but I still do not know how to do a very simple thing.

There are two tables: Mother and Childrens, of course HAS_MANY relationship. At the beginning of file _form.php are mothers details and then a table with data of children (name, age). I do not know how to define inputs in the table. I think it can be done giix-frendly, but I do not know how. Please help!

Hi, Giix CRUD will generate form for mother table, where you will be able to select existing child items with checkboxes. You need to generate models for both tables first. Then you can generate CRUD for mother model. To be able to set properties of children in mother form you need to write custom code.

Read this page to find out how to deal with multiple child models in mother form:

http://www.yiiframework.com/doc/guide/1.1/en/form.table

I just downloaded giix-1.9.1.tgz and it seems it’s gzipped twice, or rather the tar.gz i gzipped again.

Hi,

Thanks for reporting!

Another user also had problems with the archive. I had no issues here, but I’ll generate a new file and upload it.

Hi,

I have a problem. I want define separated attribute labels for differents scenarios. When my AR extends of GxActiveRecord the property scenario is empty but when extends of CActiveRecord is correct.

Please help me!

Hi All,

I’m new here, just started with YII and GIIX about a week ago.

I’m in not a PHP developer, I can only copy/paste and test the results, I only started learning about databases about one month ago.I have started using this as a tool to prototype a database I am working on. So please excuse me if the question I ask makes me look stupid.

Also please excuse me if this post is in an inappropriate place.

I am working with PHPMyAdmin as I can’t do it without a GUI :rolleyes:

I have two tables and an extra table for many_many:

Table A:

id (PRIMARY)

name

Table B:

id (PRIMARY)

name

Table AB:

a_id (INDEX)

b_id (INDEX)

(I have tried a_id as PRIMARY, a separate id field as PRIMARY and both a_id and b_id as PRIMARY)

When I run GIIX Model and Crud generators I am not sure if it works properly with the relationship or if it was designed this way:

  • You cannot add relationships from an A or B entry, you instead have to do it from the AB CRUD page.

  • When looking at an A page, you can see a list of IDs for related Bs but it would be easier to see related B(names) which link directly to the other B (and not the AB view). :blink: does that make sense?

I know I am asking a lot (and perhaps not even making sense). I don’t expect an answer to each element of this post but perhaps someone could point me in the direction of a tutorial which steps you through the entire process? That way I know I am using GIIX for many_many as it was intended.

Ta,

Kyle. :D

Hi Kyle.

Welcome to the forum!

Before experimenting with PHP, I suggest you learn a bit more about databases.

Are you using MySQL/InnoDB? If so, I suggest you to take a look at FK Constraints.

Also, this question in Stack Overflow can get you started in a more friendly way.

Absolutely.

giix does that by default, but you need to setup you table relationship first. The links above will help you with that.

Hi Mentel,

Thanks for getting back to me re my post.

I had a look at the link and it looks like I am creating the relationships as expected. I should have mentioned I have done web DESIGN(no coding besides html/css) for many years but have always used a developer for the php/databases. So I have tinkered a bit before but mostly trial and error with extensive research.

The one_many relationships GIIX is establishing are fine. I think maybe I just expected too much from many_many (in terms of ease of use) by using the initial GIIX output. Maybe need to look into fine tuning a little…

Anyway, thanks a bunch. I’ll probably be around here for a lot longer trying to learn YII. :rolleyes:

Ta,

Kyle.

Hi Kyle,

I’m sorry for not being able to help you this time.

I believe the behavior you are expecting from giix is the standard behavior.

Please open a ticket and attach all the details you have and I’ll help you.

Hi mentel,

Congratulations; this looks to be an amazing extension. I am a newbie on Yii so that I am still struggling on it.

I have a few questions to ask you about giix. Let’s assume we have the following scenario:




tbl_order

 - id

 - order_desc


tbl_products

 - id 

 - product_desc


tbl_order_products

 - id

 - id order_id

 - product_id

 - quantity



One Order has many Products and one Product can belong to multiple Orders.

Questions


1: When should I use GiixModel Generator instead of normal Model Generator?

2: Is the order from which the models are generated relevant?

3: Is it supposed for Giix to generate proper MANY_MANY relation and set the correct pivot table on pivotModels method?




// Order model

'products' => array(self::MANY_MANY,Products , ‘tbl_order_products(order_id, product_id)'),



I did some tests here and ended on changing the relations manually.

4: For the scenario presented above the Giix extension would apply as well? If you noticed there is an extra field in tbl_order_products where user can set the product quantity for a specific order. Will the saveWithRelated work fine with multiple fields?

A tutorial would be a very good complement to this great extension. I believe there are several other features that we would appreciate on this extension.

Thanks a lot,

A.Miguel

Hi,

Thanks for your kind words.

1: You can use it anytime you want. I always use it.

2: No. And you can generate all models at once using an asterisk "*" in the table name field.

3: Yes. You are having problems because of an extra and unnecessary “id” field in the pivot table. Make the FK’s the composite primary key.

4: I didn’t test this scenario, when you have to use “through”. Please report if you find any issues.

I’ve been thinking about a tutorial, but currently time doesn’t allow me to write one.

You can always request new features here.

Mentel,

WRONG! I did try with composite primary FKs but when I went to use CRUD Gen. I thought cause there was an error it was incorrect and went no further.

Then I read this just now:

So anyway took your advice and that’s all the issue was. Being inexperienced I assumed you needed to generate crud for each model.

I guess it took someone else to articulate my issue correctly. :blink:

I feel a little silly… lol. Consider my issues resolved… FOR NOW.

EDIT: ANOTHER QUESTION (Sorry)

Hopefully it is appropriate to ask this here. Could somebody please tell me the appropriate way to show similar relations between the same tables? Example:


TABLE A

id

name

description


TABLE B

id

name

description


REL A_B (first one)

a_id

b_id


REL A_B (second one)

a_id

b_id

As you can see the two relation tables are identical however I need them to serve different purposes. Is it appropriate to have it set up like that or should I instead have one relationship table with:


a_id

b_id

type (and choose if its the first or second type here)

I have tried both ways however at this stage it will only show the info from one table (I think the second one it works with) and not display the other.

Thanks… again… :) Kyle.

Hi guys,

I recommend to use MySqlWorkbench to design your database. In combination with giix you have a winning team.

In Workbench you just use the m:n identifiying relationship to connect two tables. Workbench create automatically the correct pivot table.

Giix then creates correct many-many relations where the pivot table is transparent.

Working with both tools has boosted my development iterations a lot.

BR

Sebastian

Me too.