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

Jump to content

  • (14 Pages)
  • +
  • « First
  • 10
  • 11
  • 12
  • 13
  • 14
  • 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

#221 User is offline   arx 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 23-February 12

Posted 27 July 2012 - 05:35 AM

View PostA.Miguel, on 08 November 2011 - 07:25 AM, said:

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

Does anyone suggested a solution step by step how to manage this situation? I didn't find any..
0

#222 User is offline   yugene 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 513
  • Joined: 08-August 09

Posted 22 September 2012 - 05:44 AM

Hi Mentel,
Just started to use giix extension and it looks good so far.
Though I found an issue (at least this is an issue in my case) - when GxActiveRecord.findAllAttributes() is called, attributes aren't backquoted. In my case it throws an error (as I have some fields that should be backquoted).
I'll fix it for myself but it may be useful for other implementations as well.
P.S. I'm using latest version from github
0

#223 User is offline   Rodrigo Coelho 

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

Posted 22 September 2012 - 06:43 AM

View Postyugene, on 22 September 2012 - 05:44 AM, said:

Though I found an issue (at least this is an issue in my case) - when GxActiveRecord.findAllAttributes() is called, attributes aren't backquoted.


Hi yugene,

Thanks for the heads up!
Please feel free to fork and contribute your improvements on GitHub!

Also, I suggest that you use the archive provided instead of the development version.
0

#224 User is offline   radoo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 05-September 11
  • Location:Bucharest / Romania

Posted 09 October 2012 - 10:03 AM

Awesome extension. I use it by default in all my projects.
Now for the small issue I have.For valueEx documentation says:
* @param string $attribute the attribute name (use dot to concatenate multiple attributes).


Not clear for me how you use the dot. It would suggest something like
GxHtml::valueEx($relatedModel,"id.name") 
if I want to show both id and name fields, but this doesn't work.What am I missing?

Regards!
Small web application software company.
Using Yii as the framework of choice.
0

#225 User is offline   Rodrigo Coelho 

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

Posted 09 October 2012 - 10:26 AM

Thanks, radoo!

View Postradoo, on 09 October 2012 - 10:03 AM, said:

Not clear for me how you use the dot. It would suggest something like
GxHtml::valueEx($relatedModel,"id.name") 
if I want to show both id and name fields, but this doesn't work.What am I missing?


Actually, it works the same way as CHtml::value. The dot notation is to get data from related models. Check the documentation linked, it is very well explained there.
And please post again in case you need further instructions.
0

#226 User is offline   radoo 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 05-September 11
  • Location:Bucharest / Romania

Posted 10 October 2012 - 07:41 AM

View PostRodrigo Coelho, on 09 October 2012 - 10:26 AM, said:

Thanks, radoo!



Actually, it works the same way as CHtml::value. The dot notation is to get data from related models. Check the documentation linked, it is very well explained there.
And please post again in case you need further instructions.


Got it! Thanks for the pointer. I missinterpreted the documentation.
I took concatenation ad-literam, and I was trying to get 2 attributes at the same depth level, when it's actually more like:
* @param string $attribute the attribute name (use dot to access subsequent attributes).
Small web application software company.
Using Yii as the framework of choice.
0

#227 User is offline   David Morales 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 22-October 12

Posted 22 October 2012 - 08:38 AM

Just tried to install giix (1.9.1) on a fresh install of yii (yii-1.1.12), and can't create a model

(GxActiveRecord doesn't exist)

I have rechecked all setup steps and i can't find anything wrong.

Any clues?
0

#228 User is offline   Rodrigo Coelho 

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

Posted 08 November 2012 - 11:04 PM

Hi David, I'm sorry for the delay.
I have just created a new app with Yii 1.1.12 and giix 1.9.1 to test your case. It worked perfectly here.
It may be some other thing creating the issue.

I hope you have it solved by now anyway. If so, please share your fix. Thanks!
0

#229 User is offline   nkd 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 28-September 12

Posted 09 November 2012 - 04:44 AM

The extension does not work when using:
...

'urlManager'=>array(
      'caseSensitive'=>false,
...


why?
I can solve this if I change to true the value of caseSensitive, but I would like to keep it non case sensitive!
0

#230 User is offline   Rodrigo Coelho 

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

Posted 09 November 2012 - 05:13 AM

It is a known issue. It is caused by an incompatibility with the name of the Gii generator.
A workaround is to have it set to true on your dev environment, where you use giix.

Another idea is to experiment with URL rules. Please post here the rules if it works for you. Thanks!
0

#231 User is offline   godhimself 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 23-November 12
  • Location:Grasberg in Osterholz, Niedersachsen, Deutschland

Posted 18 December 2012 - 06:59 AM

Hello everybody,

i'm testing giix with the the yii-user-extension
i have a table so called user-depndencies which has a foreign key to the tbl_users

when i generate my code with the standard gii.generators everything is fine, when i use the giix-extension, there is this error:

include(Users.php): failed to open stream: No such file or directory

that is correct, bit the file is called User.php

How can i fix them???
0

#232 User is offline   cappadochian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 150
  • Joined: 02-January 11

Posted 10 January 2013 - 05:22 PM

Hi,

I think I have found a tiny little bug:
in the admin page, in CGridView's columns:

array(
  'name' => 'related_id',
  'value' => 'GxHtml::link($data->related, array("related/view", "id" => $data->id))',

however it's supposed to be
array(
  'name' => 'related_id',
  'value' => 'GxHtml::link($data->related, array("related/view", "id" => $data->related_id))',

I hope I'm not wrong, because I'm only a tiny little beginner...
0

#233 User is offline   lilli 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 19-April 12

Posted 11 January 2013 - 05:57 PM

Hello!
Does anyone know how can I fix the "additional fields for MANY to MANY pivot table" issue?

http://www.yiiframew...post__p__188355

It's really important to me, because otherwise I'll be blocked.

Thanks,

Lilli
0

#234 User is offline   gwx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 18-January 13

Posted 20 January 2013 - 03:19 PM

Hello,

First of all thanks for this amazing extension

I was able to install giix and started created CRUDs until I wanted to make my application beautiful and installed yii-bootsrap extension as well. Now when i generate the CRUDs using giix the formatting and alignment of the pages are not correct. When I use bootstrap CRUD generator it is perfect. Am I missing something here? Please help

Thanks
0

#235 User is offline   cappadochian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 150
  • Joined: 02-January 11

Posted 21 January 2013 - 03:17 PM

Hi,

has anybody checked if I'm wrong in reply nr. 232?

otherwise, may I ask a question?
in CGridView, in columns section, the following (automatically generated):
array(
    'name' => 'rotrszid',
    'value' => 'GxHtml::valueEx($data->rotrsz)',
),

I don't see any "with" functions in (automatically generated) relations. Normally, it should be there in order to be able to access a related tables data, right? How is it possible then, that $data->rotrsz gives back a value from related table (and how does it know what to give back)? Anyway, what informations $data is holding? I can't really find a good explanation about this variable. I know that it's a representation of the current object, but what are its properties? What datas can I access through this?
I guess, somehow $data->rotrsz refers to a relation declared in BaseModel's relations sections, but the weird thing is, that $data->rotrsz is giving back the field "name"... how?! I got it! it gives back the representingColumn from related table! But why? And how...?!
I don't even see any JOINs in SQL statements in CWebLogRoute.

other question: what is the difference between the two lines? I don't see any in the resulting page.
'value' => '$data->rotrsz',
'value' => 'GxHtml::valueEx($data->rotrsz)',

thanks a lot!
0

#236 User is offline   cappadochian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 150
  • Joined: 02-January 11

Posted 24 January 2013 - 03:00 PM

can somebody please explain, or point to a direction? thanks.
0

#237 User is offline   cwhite 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 09-November 11

Posted 28 January 2013 - 10:20 AM

The creator of giix is a grand master wizard! Well done. I just have a quick question. I can't find the method in the documentation to do what I'm trying to accomplish.

I need to do a select multiple. I'm not having any issues rendering a drop-down, but the select multiple baffles me.

<label><?php echo GxHtml::encode($model->getRelationLabel('recruitColleges')); ?></label>
<?php echo $form->dropDownList($model, 'recruitColleges', GxHtml::encodeEx(
GxHtml::listDataEx(
College::model()->findAllAttributes(null, true)), false, true));

?>
0

#238 User is offline   Rodrigo Coelho 

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

Posted 28 January 2013 - 03:20 PM

Hi cwhite,

Thanks for your nice words :)

If your problem is with rendering a select multiple, say no more! You must add to your htmlOptions array:

'multiple' => 'multiple'


Please check this forum post for a working example (without giix; not tested).

I hope it helps!
0

#239 User is offline   ktwbc 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 06-December 11

Posted 20 February 2013 - 12:55 PM

Is there any way to prevent Giix from flagging things that haven't really changed? I've noticed that when I've gone back into Giix after setting up my tables, I get the Base files showing changes like:

* The followings are the available model relations:
* @property TaxCode $taxcode0
* @property Country $country0 (this line has red strikethrough)
* @property State $state0
* @property Country $country0 (this line is green for new item)
*
* @package application.models.base
* @name BaseDestination
*/


Basically one of the relations "jumped", so it's now wanting to reset. I've seen it actually go back and forth, so if I let it regenerate, then the next time I go back into Giix it will have reverted to the original order and want to regenerate again. Is your query for tables missing an Order By somewhere so it's getting random orders from SQL?
0

#240 User is offline   Rodrigo Coelho 

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

Posted 20 February 2013 - 01:20 PM

View Postktwbc, on 20 February 2013 - 12:55 PM, said:

Is there any way to prevent Giix from flagging things that haven't really changed?


Hi ktwbc,

This part of the code is actually generated by Gii, not by giix.
0

Share this topic:


  • (14 Pages)
  • +
  • « First
  • 10
  • 11
  • 12
  • 13
  • 14
  • 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