FeyX::Active::Schema - An active Fey Schema


FeyX-Active documentation Contained in the FeyX-Active distribution.

Index


Code Index:

NAME

Top

FeyX::Active::Schema - An active Fey Schema

SYNOPSIS

Top

  use FeyX::Active::Schema;

  my $schema = FeyX::Active::Schema->new( name => 'MySchema' );

  $schema->dbi_manager->add_source( dsn => 'dbi:SQLite:dbname=foo' );

  # ...

DESCRIPTION

Top

This is just a subclass of Fey::Schema which also happens to have a Fey::DBIManager instance handy. Nothing much else going on here actually.

ATTRIBUTES

Top

dbi_manager

This will lazily create a Fey::DBIManager instance to be used by this schema.

As of 0.02, this attribute is read/write so that it better works with Fey::Loader, like so:

  my $dbi_manager = Fey::DBIManager->new();

  $dbi_manager->add_source(...);

  my $loader = Fey::Loader->new(
      dbh          => $dbi_manager->default_source->dbh,
      schema_class => 'FeyX::Active::Schema',
      table_class  => 'FeyX::Active::Table',
  );

  my $schema = $loader->make_schema;

  $schema->dbi_manager($dbi_manager);

BUGS

Top

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.

AUTHOR

Top

Stevan Little <stevan.little@iinteractive.com>

COPYRIGHT AND LICENSE

Top


FeyX-Active documentation Contained in the FeyX-Active distribution.

package FeyX::Active::Schema;
use Moose;

our $VERSION   = '0.03';
our $AUTHORITY = 'cpan:STEVAN';

use Fey::Table;
use Fey::DBIManager;

extends 'Fey::Schema';

has 'dbi_manager' => (
    is      => 'rw',
    isa     => 'Fey::DBIManager',
    lazy    => 1,
    default => sub { Fey::DBIManager->new() },
);

__PACKAGE__->meta->make_immutable;

no Moose; 1;

__END__