Fey::ORM::Schema - Provides sugar for schema-based classes


Fey-ORM documentation Contained in the Fey-ORM distribution.

Index


Code Index:

NAME

Top

Fey::ORM::Schema - Provides sugar for schema-based classes

VERSION

Top

version 0.43

SYNOPSIS

Top

  package MyApp::Schema;

  use Fey::ORM::Schema;

  has_schema ...;

  no Fey::ORM::Schema;

DESCRIPTION

Top

Use this class to associate your class with a schema. It exports a number of sugar functions to allow you to define things in a declarative manner.

EXPORTED FUNCTIONS

Top

This package exports the following functions:

has_schema($schema)

Given a Fey::Schema object, this method associates that schema with the calling class.

AUTHOR

Top

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

Top


Fey-ORM documentation Contained in the Fey-ORM distribution.

package Fey::ORM::Schema;
BEGIN {
  $Fey::ORM::Schema::VERSION = '0.43';
}

use strict;
use warnings;
use namespace::autoclean;

use Fey::Meta::Class::Schema;
use Fey::Object::Schema;

use Moose 1.15 ();
use MooseX::StrictConstructor 0.13 ();
use Moose::Exporter;
use MooseX::Params::Validate qw( pos_validated_list );

Moose::Exporter->setup_import_methods(
    with_meta => [qw( has_schema )],
    also      => [ 'Moose', 'MooseX::StrictConstructor' ],
);

sub init_meta {
    shift;
    my %p = @_;

    return Moose->init_meta(
        %p,
        base_class => 'Fey::Object::Schema',
        metaclass  => 'Fey::Meta::Class::Schema',
    );
}

sub has_schema {
    my $meta = shift;

    my ($schema) = pos_validated_list( \@_, { isa => 'Fey::Schema' } );

    $meta->_associate_schema($schema);
}

1;

# ABSTRACT: Provides sugar for schema-based classes




__END__