[Dbix-class] Defining storage in schema
Matt S Trout
dbix-class at trout.me.uk
Thu Jan 12 22:16:02 CET 2006
On Thu, Jan 12, 2006 at 08:35:35AM -0800, Alan Humphrey wrote:
> I'd like to override the storage used by each of the classes in my schema.
> This is what I've got now in my DB class:
>
>
>
> BirdWeb::Admin::Model::BirdWebSchema->compose_connection( __PACKAGE__,
> @conn_info );
>
>
>
> my $store = BirdWeb::Admin::Model::NoBindStorage->new();
>
> $store->connect_info( \@conn_info );
What are you trying to achieve here? What does NoBindStorage *do*?
> my $classes = __PACKAGE__->classes();
>
> foreach my $class (keys ( %{$classes} ) ) {
>
> ${$classes}{$class}->storage( $store );
>
> }
>
>
>
> Is this the best way to go or is there a more straightforward way that I'm
> missing?
>
>
>
> Related: should each class get its own $store?
Absolutely not. Storage is becoming an attribute of the live schema, so
that approach will become fairly suicidal very soon.
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list