Quick links: Content - sections - sub sections
EN FR
Quick Search Advanced search
 
Page

  [Opened] CRUD controller: how to redirect and how to use multiple columns PK

Posted by aeiaco on 11/27/2009 18:05

I am dealing with the powerful CRUD controller. Now I faced two problems:

1) I was not capable of using the CRUD with a simple table build on a two columns primary key. I looked the sources, and it seems to me that the CRUD engine only use the first key. Is it intentional ? I solved introducing a single column PK, even if it is a DB redundant information.

2) I would like to redirect to other page from inside CRUD controller. For example: I want to check something in the create (precreate) action. If the conditions are not satisfied, I would redirect to and error page. Now, I tried in the _precreate method and in the _create one, without success. Should I overload the CRUD methods instead ?

THX for the help.

  [Opened] Re: CRUD controller: how to redirect and how to use multiple columns PK

Reply #1 Posted by laurentj on 11/30/2009 02:16

Hello,

1) you have the jControllerDaoCrudDfk controller, to manage records with a primary key based on two fields. see the API reference.

2) yes, in the case of the precreate action, you should redefine the method.

Note that the CRUD controller is design for very common uses. If you have many complex things, and if the CRUD controller doesn't fit your needs, don't hesitate to create your own controller, it will be simplier. Manipulating jForms and jDao is in fact easy, and the complexity inside jControllerDaoCrud, is only about features for the customization of the CRUD :-) . Don't hesitate also to read the source code fo jControllerDaoCrud or jControllerDaoCrudDfk.

 
Page
  1. Re: CRUD controller: how to redirect and how to use multiple columns PK