GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Reaction::InterfaceModel::Reflector::DBIC(3) User Contributed Perl Documentation Reaction::InterfaceModel::Reflector::DBIC(3)

Reaction::InterfaceModel::Reflector::DBIC - Automatically Generate InterfaceModels from DBIx::Class models

The InterfaceModel reflectors are classes that are meant to aid you in easily generating Reaction::InterfaceModel classes that represent their underlying DBIx::Class domain models by introspecting your DBIx::Class::ResultSources and creating a collection of Reaction::InterfaceModel::Object and Reaction::InterfaceModel::Collection classes for you to use.

The default base class of all Object classes will be Reaction::InterfaceModel::Object and the default Collection type will be Reaction::InterfaceModel::Collection::Virtual::ResultSet.

Additionally, the reflector can create InterfaceModel actions that interact with the supplied Reaction::UI::Controller::Collection::CRUD, allowing you to easily set up a highly customizable CRUD interface in minimal time.

At this time, supported collection actions consist of:

Reaction::InterfaceModel::Action::DBIC::ResultSet::Create
Creates a new item in the collection and underlying ResultSet.
Reaction::InterfaceModel::Action::DBIC::ResultSet::DeleteAll
Deletes all the items in a collection and it's underlying resultset using "delete_all"

And supported object actions are :

Update - via Reaction::InterfaceModel::Action::DBIC::Result::Update
Updates an existing object.
Delete - via Reaction::InterfaceModel::Action::DBIC::Result::Delete
Deletes an existing object.

    package MyApp::IM::TestModel;
    use base 'Reaction::InterfaceModel::Object';
    use Reaction::Class;
    use Reaction::InterfaceModel::Reflector::DBIC;
    my $reflector = Reaction::InterfaceModel::Reflector::DBIC->new;

    #Reflect everything
    $reflector->reflect_schema
      (
       model_class  => __PACKAGE__,
       schema_class => 'MyApp::Schema',
      );

    #reflect everything except for the FooBar and FooBaz classes
    $reflector->reflect_schema
      (
       model_class  => __PACKAGE__,
       schema_class => 'MyApp::Schema',
       sources => [-exclude => [qw/FooBar FooBaz/] ],
       # you could also do:
       sources => [-exclude => qr/(?:FooBar|FooBaz)/,
       # or even
       sources => [-exclude => [qr/FooBar/, qr/FooBaz/],
      );

    #reflect only the Foo family of sources
    $reflector->reflect_schema
      (
       model_class  => __PACKAGE__,
       schema_class => 'MyApp::Schema',
       sources => qr/^Foo/,
      );

    #Reflect Foo and Baz in their entirety and exclude the field 'avatar' in the Bar ResultSource
    $reflector->reflect_schema
      (
       model_class  => __PACKAGE__,
       schema_class => 'MyApp::Schema',
       sources => [qw/Foo Baz/,
                   [ Bar => {attributes => [[-exclude => 'avatar']] } ],
                   # or exclude by regex
                   [ Bar => {attributes => [-exclude => qr/avatar/] } ],
                   # or simply do not include it...
                   [ Bar => {attributes => [qw/id name description/] } ],
                  ],
      );

Allow the reflector to dump the generated code out as files, eliminating the need to reflect on startup every time. This will likely take quite a bit of work though. The main work is already in place, but the grunt work is still left. At the moment there is no closures that can't be dumped out as code with a little bit of work.

See Reaction::Class for authors.

See Reaction::Class for the license.
2010-11-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.