Wednesday, September 17, 2008

Re: Ideas about models and associations

How about defining an ProfilesController as the base class for the
other controllers for your different models.

That what we have done in a similar case, where we had contacts and
people and companies
depending on the ContactsController.


On Wed, Sep 17, 2008 at 8:10 AM, Günther Theilen <theilen@eqi.de> wrote:
>
> Hi!
>
> I'm working on a new project and right now I'm struggling a bit to put
> the requirements together in a proper cake-like way.
>
> I use Auth/ACL which is set up and works fine. The users who can log-in
> belong to three different groups. These groups are defined by a field
> "role_id" in the user table.
>
> Now I want to add profiles for the users. The problem is that each group
> has a different type of profile with different fields in it so I defined
> three models for the profiles.
>
> My first idea was to do something like this in my user model:
>
> var $hasOne = array(
> 'AdminProfile' => array(
> 'className' => 'AdminProfile',
> 'conditions' => 'User.role_id = 1'
> ),
> 'EditorProfile' => array(
> 'className' => 'EditorProfile',
> 'conditions' => 'User.role_id = 2'
> ),
> 'ReviewerProfile' => array(
> 'className' => 'ReviewerProfile',
> 'conditions' => 'User.role_id = 3'
> )
> );
>
> Which seems to work to a degree but is a bit of a hassle when it comes
> to editing the profiles and validating the form data.
>
> How would you solve this?
>
> Regards
> Guenther
>
> >
>

--
Siegfried Hirsch
hhS - Welserstr. 1 - 81373 München - (089) 5484 3564 - skype:shirsch
Fax +49 - (0)89 - 943 992 698 - http://www.rss-blogger.de
http://www.newsbee.de NewsBee 2 - customized RSS solutions
http://abo-stop.de jetzt mit kostenlosem Kündigungsgenerator

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: