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

Jump to content

  • (14 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5
  • 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

#41 User is offline   Athos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 07-January 11

Posted 19 January 2011 - 05:28 PM

I found a problem when the relationship is not required and is not satisfied.

The solution is to check below:


GxHTML.php line 120
if (is_object($model) && $attribute === null)

Thanks Google Translator to helping me write the posts :)
0

#42 User is offline   mongoose76 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 13-January 11

Posted 03 February 2011 - 04:17 AM

Hi,

First of all thanks for this extension, I am using it and it is very cool.
I want to share a very small idea that I had with the rest of the group, maybe someone will find it useful or maybe you include it in the extension. If this is not the correct place point me in the right direction. In the meantime I will explain.

I am doing a back-office interface in my native language, Romanian. My database is in Romanian as well so the plurals of the models sound ridiculous so I have to always change them after I re-generate with giix CRUD. I re-generate a lot since I am playing around with the templates. Now, the solution I found to not change manually the resulting names is to extend the pluralize method in GiixCrudCode.php with the following:

public function pluralize($name) {
	return Yii::t("app", parent::pluralize($name));
}


This will hard-code the translated plural in the resulting CRUD files, but that's exactly what I want to achieve. Of course you need to have internalization enabled in your project and an app.php file with the translations you want in the messages folder.

With a little change to the templates i18s support can be added so the plurals are taken from the messages files at runtime rather than generate time.

Hope this helps someone.

Doru P.
0

#43 User is offline   Athos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 07-January 11

Posted 03 February 2011 - 06:41 AM

Hi Doru,

I've done differently. I created two more fields to inform the Portuguese name of the screen and the plural word.

This was necessary due to the massive use of special characters in my language and the database model should not be used.
Thanks Google Translator to helping me write the posts :)
0

#44 User is offline   mongoose76 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 13-January 11

Posted 03 February 2011 - 06:55 AM

Where have you placed these fields? In the database?

View PostAthos, on 03 February 2011 - 06:41 AM, said:

Hi Doru,

I've done differently. I created two more fields to inform the Portuguese name of the screen and the plural word.

This was necessary due to the massive use of special characters in my language and the database model should not be used.

0

#45 User is offline   Athos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 07-January 11

Posted 03 February 2011 - 10:52 AM

In the form of generation of CRUD. They will only be used in generation time and are not stored.
Thanks Google Translator to helping me write the posts :)
0

#46 User is offline   mongoose76 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 14
  • Joined: 13-January 11

Posted 03 February 2011 - 11:47 AM

Aha. Well, seems like a workable solution, so there u go, people have two ways of solving the pluralize problem and maybe more. Plurals in English are easy but in Romanian it is hard to determine since they reply on the gender of the word. Very hard to determine, so it is much more easy to just provide it.
Hope this helps someone, I am trying to give something back to the Yii community since this is by far the best framework I have ever worked with. It has absolutely everything I need from a framework.
0

#47 User is offline   Kabinenkoffer 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 04-November 10
  • Location:Karlsruhe

Posted 13 February 2011 - 06:18 AM

I had a problem while using the relation widget/extension and the update/create function generated:


$relatedData = array(
				'cmsMedias' => $_POST['CmsContent']['cmsMedias'] === '' ? null : $_POST['CmsContent']['cmsMedias']);


was generated. The Problem is ['cmsMedias'] that should be ['CmsMedia'] to work with the widget. Maybe there is a way to include the relation widget or to make it compatible?

I also have a Problem with the create part. the relational data is not updated, yii stays on the create form pafe with no message and no error. the update function is working. any ideas?
0

#48 User is offline   keithws 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 03-January 11

Posted 10 March 2011 - 09:43 PM

View PostKabinenkoffer, on 13 February 2011 - 06:18 AM, said:

I also have a Problem with the create part. the relational data is not updated, yii stays on the create form pafe with no message and no error. the update function is working. any ideas?


I too am experiencing this problem. The root of the problem is that the id (primary key value) of the record that was just created is missing. I am investigating a solution. Anyone else already fix this?

Cheers,
Keith
0

#49 User is offline   keithws 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 03-January 11

Posted 11 March 2011 - 12:05 AM

I was able to fix the issue where saving a new record with related data was failing. For details and the patch, please check out the issue I created on the giix Google Code site: http://code.google.c...ues/detail?id=5

By the way, I created another issue because deletes would not work if you had foreign key constraints in your database. I wrote a beforeDelete function to automatically delete MANY_MANY, HAS_MANY, AND HAS_ONE related data so the main model record will delete without violating any foreign key constraints. You can get the patch here: http://code.google.c...ues/detail?id=4

Cheers,
Keith
0

#50 User is offline   Athos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 07-January 11

Posted 15 March 2011 - 01:17 PM

You able to to make the saveWithRelated() work with an attribute as safe in rules()?

See the original problem here:
http://www.yiiframew.../page__p__83060
Thanks Google Translator to helping me write the posts :)
0

#51 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 300
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 15 March 2011 - 01:45 PM

just a hint to the developer: plese check if the performAjaxValidation catches the request or not. If not, this may be the solution to the mentioned duplicate entry Bug. I had this within the gii-template-collection, too.
1

#52 User is offline   Athos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 07-January 11

Posted 15 March 2011 - 02:36 PM

I preferred to use the eadvancedarbehavior extension instead of saveWithRelated().
Thanks Google Translator to helping me write the posts :)
0

#53 User is offline   Sajid 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 10-March 11

Posted 18 March 2011 - 09:50 AM

I just used this extension recently it has few small bugs as I took code from repo , it really perform well with Many to Many.
it has issue with Form like it dont generate id to edit or view from grid and in views it creates issue with breadcumbs and menu(I just defined these varaibles in controler then it works smooth)

Very amazing App , True Code Generation is on the way

Sajid
0

#54 User is offline   Rodrigo Coelho 

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

Posted 13 April 2011 - 01:44 AM

Dear,
I've been very busy lately, but I hope I can resume working in giix soon.
There are some pending bugfixes (some are already fixed in trunk, check there!) and the roadmap is huge. Great things will come.
Please keep the comments, suggestions and bug reports (and patches if you can) coming!

Thank you,
Rodrigo Coelho - mentel
0

#55 User is offline   Elfange 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 14-April 11

Posted 20 April 2011 - 07:35 AM

I've got a question.
I have 3 tables :

CREATE TABLE `utilisateur` (
	`id_utilisateur` INT( 9 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
	`login` VARCHAR ( 30 ) NOT NULL ,
	UNIQUE ( `login` )
)

CREATE TABLE `developpeur` (
	`id_utilisateur` INT( 9 ) NOT NULL ,
	`id_projet` INT( 9 ) NOT NULL ,
	`notification_email` TINYINT(1) NOT NULL DEFAULT '1' ,
	PRIMARY KEY ( `id_utilisateur` , `id_projet` ) ,
	FOREIGN KEY ( `id_utilisateur` ) REFERENCES `utilisateur` ( `id_utilisateur` )  ,
	FOREIGN KEY ( `id_projet` ) REFERENCES `projet` ( `id_projet` )
);

CREATE TABLE `projet` (
	`id_projet` INT( 9 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
	`nom_application` VARCHAR( 50 ) NOT NULL ,
	UNIQUE ( `nom_application` ),
);


Then one 'utilisateur' can activate the email notification on a 'projet' linked by the table 'developpeur'.

I want to create on the user form an option to activate or not the email notification on linked project.

I use tour extension.

What's the best way to do it ?
Btw I didn't understood your method 'pivot', could it help me ?

Thx
0

#56 User is offline   Rodrigo Coelho 

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

Posted 06 May 2011 - 12:21 AM

Dear,

giix has a new version: 1.5!
Go download it right now!

Several bugs were fixed (thanks for the reporters!) and some new functionality were added, including:

Native support for saving multiple (related or not) records with the new method GxActiveRecord::saveMultiple.
This method allows you to save many models at once, in a transaction (if you want) in a painless way. Try it!
It can even automatically detect all new active records having a BELONGS_TO relation and fill in the data for their FK. Awesome.

Now GxController::performAjaxValidation supports multiple models. :)

What are you waiting for?

Don't forget to vote.
0

#57 User is offline   Rodrigo Coelho 

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

Posted 09 May 2011 - 01:52 PM

Dear,

giix version 1.6 is released!
Go download it right now!

Improvements:
All known bugs fixed.
More automatic magic.
More flexibility.
More support to composite PK tables (but still incipient support).

giix is evolving fast. Stay tuned!


Download giix and vote it up!
0

#58 User is offline   Srinivasan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 22-February 11
  • Location:Trichy, TN, INDIA

Posted 09 May 2011 - 09:37 PM

Please help me

I got error yet when I try to delete a record in MANY TO MANY RELATION [giix v1.6 and Yii v1.1.7]

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`tnewsnew`.`tbl_news_category`, CONSTRAINT `fk_newscategory_category` FOREIGN KEY (`category_id`) REFERENCES `tbl_category` (`id`) ON UPDATE CASCADE). The SQL statement executed was: DELETE FROM `tbl_category` WHERE `tbl_category`.`id`=4 

0

#59 User is offline   Rodrigo Coelho 

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

Posted 09 May 2011 - 09:57 PM

View PostSrinivasan, on 09 May 2011 - 09:37 PM, said:

Please help me


Hi,
It is not a giix issue. You have a FK constraint failing. You have "on update cascade" setup, you may want "on delete cascade", too.
0

#60 User is offline   Athos 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 90
  • Joined: 07-January 11

Posted 12 May 2011 - 02:46 PM

Hello Mentel,

I have been using the extension and am very pleased.
I made some adjustments to suit me better. See below for their opinions on the possibility of deploying them officially:

- In the page of view's action, before listing the relations, with a tag <h2> highlight that these are dependent or related records.
- On the generation of CRUD, include two more fields. To enter a screen name in my language and the other for the plural name. You know in any language other than English you can not retrieve the correct name of the nomenclature of the database.
- For the same reasons, can not catch the names of the attributes directly from the data model. Then the method attributeLabes should not stay on the base file, since it must necessarily be changed. If he remains at the base, can not be the goal of these files remain intact.
- Many databases have fields in each table to log user actions. I then created a method (getEditableColumns) to always ignore them in loops over the columns of the table, not to create the inputs and validations on the form, for example.
- At least for me it was very important to change the method model->search() to do a merge with other default options passed as parameter.


------
Em português:


Olá Mentel,

Venho utilizando a extensão e estou muito satisfeito.
Fiz algumas adaptações para me atender melhor. Seguem abaixo para sua avaliação sobre a possibilidade de implantá-las oficialmente:

- Na tela da action view, antes de listar as relações, destacar com uma tag <h2> que se tratam de registros dependentes ou relacionados.
- Na tela de geração do CRUD, incluí mais dois campos. Um para digitar o nome da tela no meu idioma e o outro para o nome no plural. Você sabe que em qualquer língua que não seja o inglês não dá para recuperar o nome correto da nomenclatura do banco de dados.
- Muitos bancos de dados têm campos para log em cada tabela. Criei então um método (getEditableColumns) para sempre ignorá-los nos loops sobre as colunas da tabela, para não criar os inputs e as validações no formulario, por exemplo.
- Pelo mesmo motivo citado acima, não dá pra pegar os nomes dos atributos direto do modelo de dados. Então o método attributeLabes não deveria ficar no arquivo base, já que ele necessariamente deverá ser alterado. Se ele permanece na base, não consegue-se o objetivo desses arquivos permanecerem intactos.
- Pelo menos para mim, foi muito importante alterar o método model->search() para fazer um merge das opções padrão com outras passadas como parâmetro.
Thanks Google Translator to helping me write the posts :)
0

Share this topic:


  • (14 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

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