Hey there,

I've finished quite a lot of the User stuff for the Redracer Project  
(not yet commited). But while I was writing the register action I hit  
a problem on which I would like to here some comments.
When a new user registers of course he cannot use a username or email  
which is already used by some other user (you'll be able to login via  
username or email). Of course I can create unique indexes in the DB  
and handle the Exception. But this would make the action very  
dependend on a specific library, in my case Doctrine.

My next thought was "Write a custom validator which checks if either  
username or email is already used)
Since I have two global models (UserManager, User) whereas the  
UserManager handles all interations with the DB, custom validator  
could use the model to determine wether username and/or email is  
already used.

For me the second approch seems to be more "Agavi like", but maybe  
there is a thrid way to achieve this.
Also since I'm a newbie to doctrine, maybe doctrine has a way to  
validate/test which field would not meet the unique attribute anymore  
if the new record would be inserted. Currently I'm doing $user- 
 >save(); and then I get the exception if uniqueness is broken.

Cheers
Benjamin


_______________________________________________
Agavi Dev Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/dev

Reply via email to