Tahnks for the reply. It's really interesting to read through it and I
think I have a pretty clear idea now of the purpose of EAV and of
which are the context in which is worth to aplly it.
I'm looking forward for your user-profile plugin;)

On 2/16/09, LunarDraco <mdc...@gmail.com> wrote:
>
> I use EAV because I have multiple clients using the same user/profile
> code. Each client wants a different list of profile fields. I found
> myself rewritting the same code slightly different each time. It was
> time to automate some of that process.
> I have two models Profile and ProfileFields. The ProfileFileds has its
> own set of admin actions, Model, controller and view set for adding,
> updating the ProfileFields.
>
> In the Profile model itself I have a few fixed fields which are
> available for everyone "First Name","Last Name", "email" and also my
> foreign key to bind to the user.
>
>> Actually, I can't see how using EAV would mean that updating
>> view/models would be unnecessary. If they don't change, what's the
>> point in adding new attributes?
>
> The view of the Profile is generated from the data in the
> ProfileFileds so It is not being modified manually there is some logic
> behind this that generates the display elements. Pretty much like how
> cake bakes in the first place. This one just bakes on the fly based on
> the available ProfileFileds. Each ProfileFileds recorde has a Group
> Level for when the field should be visible so each users gets a
> different set of profile fields based on which group(s) they belong
> to.
>
> The goal of dynamicly adding a new profile field presents a problem
> with existing users of getting them to fill in the new field.
> This is solved by checking if the profile for a user is valid when
> they login. If it is not valid redirect to the proifle edit. Now when
> I add a new field the next time a user logs in he is redirected to
> fill in the new field for his profile.
> if(!$this->Profile->validates()){
>   $this->Session->setFlash(__('Your profile is out of date or missing
> new required fields. Please update your profile.',true));
>   $this->redirect(array('admin' => false, 'controller' =>
> 'profiles','action'=>'edit', $this->data['Profile']['id']));
> }
>
> I've started to convert this user/profile code to a cake plugin
> because the power of cake Plugins make it possible for this User/
> Profile plugin to be deployed into any of the apps I create. My apps
> are primarily intended to be deployed/run within my client companies
> LAN, because the data is somewhat sensitive to that client company.
>
> I agree if this were a single site with a single app the EAV pattern
> does not make sense. But my goals are to broaden my client base and
> reduce my time to deploy for those clients. User Authentication and
> Profile info is almost always a required part of the app and almost
> always has a different set of fields. Cake's plugins have really
> helped with that goal. And a configurable plugin minimizes the number
> of different User profile MVC logic I need to build. I will have one
> configurable plugin to maintain for many different sites.
>
> Remember these development design patterns exist for a reason, that
> reason is to solve a specific problem. It may not always be clear up
> front why the pattern was used when thinking or looking at a single
> app. Clearly if the EAV is not solving a problem for you then you
> should not be using it. Perhaps your app or goal has different
> requirements and the problem you are trying to solve does not benefit
> from the EAV pattern.
>
> I intend to make public my User/Profile plugin once it is fully
> refined and I have the time to properly write a clean article
> explaining all the the objects and what they do. A lot of this code
> has come from many different post's and ideas generated in these
> forums its only right that I share back to the community. The first
> release of this plugin will use Auth but does not use ACL. However I
> know ACL is an important piece of the puzzle for some apps, I'm just
> waiting for it to mature, or rather I'm waiting for my brain to mature
> enough to completely understand cake's implementation of ACL.
>
> -LunarDraco
> >
>


-- 
Andrea "Mirthis" Cardinale
Webmaster in the "Land ...of Silence"
http://www.sonataarctica.it
MSN: mirt...@gmail.com

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to