Alzabo
view release on metacpan or search on metacpan
lib/Alzabo/MethodMaker.pm view on Meta::CPAN
could write C<< $schema->Movie->title >>.
=item * insert_hooks => $bool
Look for hooks to wrap around the C<insert()> method in
L<C<Alzabo::Runtime::Table>|Alzabo::Runtime::Table>. See L<Loading
Classes> for more details. You have to define either a
C<pre_insert()> and/or C<post_insert()> method for the generated table
class or this parameter will not do anything. See the
L<HOOKS|/"HOOKS"> section for more details.
=back
=head2 Row object methods
=over 4
=item * row_columns => $bool
This tells MethodMaker to create get/set methods for each column a row
has. These methods take a single optional argument, which if given
will cause that column to be updated for the row.
=item * update_hooks => $bool
Look for hooks to wrap around the C<update> method in
L<C<Alzabo::Runtime::Row>|Alzabo::Runtime::Row>. See L<Loading
Classes> for more details. You have to define a C<pre_update()>
and/or C<post_update()> method for the generated row class or this
parameter will not do anything. See the L<HOOKS|/"HOOKS"> section for
more details.
=item * select_hooks => $bool
Look for hooks to wrap around the C<select> method in
L<C<Alzabo::Runtime::Row>|Alzabo::Runtime::Row>. See L<Loading
Classes> for more details. You have to define either a
C<pre_select()> and/or C<post_select()> method for the generated row
class or this parameter will not do anything. See the
L<HOOKS|/"HOOKS"> section for more details.
=item * delete_hooks => $bool
Look for hooks to wrap around the C<delete> method in
L<C<Alzabo::Runtime::Row>|Alzabo::Runtime::Row>. See L<Loading
Classes> for more details. You have to define either a
C<pre_delete()> and/or C<post_delete()> method for the generated row
class or this parameter will not do anything. See the
L<HOOKS|/"HOOKS"> section for more details.
=item * foreign_keys => $bool
Creates methods in row objects named for the table to which the
relationship exists. These methods return either a single
L<C<Alzabo::Runtime::Row>|Alzabo::Runtime::Row> object or a single
L<C<Alzabo::Runtime::RowCursor>|Alzabo::Runtime::RowCursor> object,
depending on the cardinality of the relationship.
For exa
Movie Credit
--------- --------
movie_id movie_id
title person_id
role_name
This would create a method for Movie row objects called C<Credit()>
which would return a cursor for the associated Credit table rows.
Similarly, Credit row objects would have a method called C<Movie()>
which would return the associated Movie row object.
=item * linking_tables => $bool
A linking table, as defined here, is a table with a two column primary
key, with each column being a foreign key to another table's primary
key. These tables exist to facilitate n..n logical relationships. If
both C<foreign_keys> and C<linking_tables> are true, then methods will
be created that skip the intermediate linking tables.
For example, with the following tables:
User UserGroup Group
------- --------- --------
user_id user_id group_id
user_name group_id group_name
The "UserGroup" table exists solely to facilitate the n..n
relationship between "User" and "Group". User row objects will have a
C<Group()> method, which returns a row cursor of Group row objects.
And Group row objects will have a C<User()> method which returns a row
cursor of User row objects.
=item * lookup_columns => $bool
Lookup columns are columns in foreign tables to which a table has a
many-to-one or one-to-one relationship to the foreign table's primary
key. For example, given the tables below:
Restaurant Cuisine
--------- --------
restaurant_id cuisine_id
restaurant_name (n..1) description
phone spiciness
cuisine_id
In this example, Restaurant row objects would have
C<Cuisine_description()> and C<Cuisine_spiciness> methods which
returned the corresponding values from the C<Cuisine> table.
=item * self_relations => $bool
A self relation is when a table has a parent/child relationship with
itself. Here is an example:
Location
--------
location_id
location_name
parent_location_id
NOTE: If the relationship has a cardinality of 1..1 then no methods
will be created, as this option is really intended for parent/child
relationships. This may change in the future.
In this case, Location row objects will have both C<parent()> and
C<children()> methods. The parent method returns a single row, while
the C<children()> method returns a row cursor of Location rows.
=back
( run in 1.529 second using v1.01-cache-2.11-cpan-13bb782fe5a )