logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

DBIx::Class::Schema::PopulateMore::Command - Command Class to Populate a Schema

Attributes

       This class defines the following attributes.

   schema
       This is the Schema we are populating

   exception_cb
       contains a callback to the exception method supplied by DBIC

   definitions
       This is an arrayref of information used to populate tables in the database

   match_condition
       How we know the value is really something to inflate or perform a substitution on.  This get's the
       namespace of the substitution plugin and it's other data.

   visitor
       We define a visitor so that we can perform the value inflations and or substitutions.  This is still a
       little work in progress, but it's getting neater

   rs_index
       The index of previously inflated resultsets.  Basically when we create a new row in the table, we cache
       the result object so that it can be used as a dependency in creating another.

       Eventually will be moved into the constructor for a plugin

   set_rs_index
       Set an index value to an inflated result

   get_rs_index
       given an index, returns the related inflated resultset

   inflator_loader
       Loads each of the available inflators, provider access to the objects

   inflator_dispatcher
       Holds an object that can perform dispatching to the inflators.

Author

       Please see DBIx::Class::Schema::PopulateMore For authorship information

Description

       This is a command pattern  class to manage the job of populating a DBIx::Class::Schema with information.
       We break this out because the actual job is a bit complex, is likely to grow more complex, and so that we
       can more easily identify refactorable and reusable parts.

License

       Please see DBIx::Class::Schema::PopulateMore For licensing terms.

perl v5.36.0                                       2023-01-22             DBIx::Class::Sc...teMore::Command(3pm)

Methods

       This module defines the following methods.

   _build_visitor
       lazy build for the "visitor" attribute.

   _build_inflator_loader
       lazy build for the "inflator_loader" attribute

   _build_inflator_dispatcher
       lazy build for the "inflator_dispatcher" attribute

   execute
       The command classes main method.  Returns a Hash of the created result rows, where each key is the named
       index and the value is the row object.

   dispatch_inflator
       Dispatch to the correct inflator

   create_fixture({})
       Given a hash suitable for a DBIx::Class::Resultset create method, attempt to update or create a row in
       the named source.

       returns the newly created row or throws an exception if there is a failure

   merge_fields_values
       Given a fields and values, combine to a hash suitable for using in a create_fixture row statement.

   field_value
       Correctly create an array from the fields, values variables, skipping those where the value is undefined.

   coerce_to_array
       given a value that is either an arrayref or a scalar, put it into array context and return that array.

Name

       DBIx::Class::Schema::PopulateMore::Command - Command Class to Populate a Schema

See Also