Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Reaction::InterfaceModUserRContributedtPerl:InterfaceModel::Reflector::DBIC(3)

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

DESCRIPTION
       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.

SYNOPSIS
	   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',
	     );

   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/] } ],
			 ],
	     );

ATTRIBUTES
   make_classes_immutable
   object_actions
   collection_actions
   default_object_actions
   default_collection_actions
   builtin_object_actions
   builtin_collection_actions
METHODS
   new
   _all_object_actions
   _all_collection_actions
   dm_name_from_class_name
   dm_name_from_source_name
   class_name_from_source_name
   class_name_for_collection_of
   merge_hashes
   parse_reflect_rules
   merge_reflect_rules
   reflect_schema
   _compute_source_options
   add_source
   reflect_source
   reflect_source_collection
   reflect_source_object
   reflect_source_object_attribute
   parameters_for_source_object_attribute
   reflect_source_action
   parameters_for_source_object_action_attribute
TODO
       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.

AUTHORS
       See Reaction::Class for authors.

LICENSE
       See Reaction::Class for the license.

perl v5.24.1			  Reaction::InterfaceModel::Reflector::DBIC(3)

NAME | DESCRIPTION | SYNOPSIS | ATTRIBUTES | METHODS | TODO | AUTHORS | LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Reaction::InterfaceModel::Reflector::DBIC&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help