|
NAMEReaction::InterfaceModel::Reflector::DBIC - Automatically Generate InterfaceModels from DBIx::Class modelsDESCRIPTIONThe 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:
And supported object actions are :
SYNOPSISpackage 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', ); Selectively including and excluding sources#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/, ); Selectively including and excluding fields in sources#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/] } ], ], ); ATTRIBUTESmake_classes_immutableobject_actionscollection_actionsdefault_object_actionsdefault_collection_actionsbuiltin_object_actionsbuiltin_collection_actionsMETHODSnew_all_object_actions_all_collection_actionsdm_name_from_class_namedm_name_from_source_nameclass_name_from_source_nameclass_name_for_collection_ofmerge_hashesparse_reflect_rulesmerge_reflect_rulesreflect_schema_compute_source_optionsadd_sourcereflect_sourcereflect_source_collectionreflect_source_objectreflect_source_object_attributeparameters_for_source_object_attributereflect_source_actionparameters_for_source_object_action_attributeTODOAllow 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.AUTHORSSee Reaction::Class for authors.LICENSESee Reaction::Class for the license.
Visit the GSP FreeBSD Man Page Interface. |