Rodrigo <rodrigolive <at> gmail.com> writes:

> 
> In my neck of the woods, for large applications, we're using the DataMapper 
pattern (separation of business model and database layer), which translates 
into 
having a model layer like yours: 
> 
> 
> Model::User->create('bob');
> 
> 
> Which in turn wraps, into a single transaction if possible, calls such as: 
> 
> 
> 
> $schema->resultset('User')->create({ username=>'bob', password_reset=>1 ); 
> 
> $schema->resultset('UsersInGroup')->create( ... ); 
> $ldap->create_user( ... );
> $email->notify_admin( "user $user created" );
> $email->notify_user("your password is..." );
> 
 
> I don't think you need use_moose=>1 if you're going towards this pattern. I 
recommend taking a look into  MooseX::Types::DBIx::Class, which can be combined 
with delegation ("handles") and method modifiers ("around") that help you 
simplify method calls:
> 
> 
> 
> has 'row' => ( is=>'rw', isa=>Row, handles=>[qw/insert create delete/] );   
> has 'rs' => (is=>'rw', isa=>ResultSet, handles=>[qw/search find/] );
> 

(I apologize for late questions) How do you pass $schema to 
Model::User::create? 
Do you use class accessor or do you have separate bussiness object wrapping 
resultset?

Roman Daniel




_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to