Interchange6-Schema

 view release on metacpan or  search on metacpan

lib/Interchange6/Schema/Result/Navigation.pm  view on Meta::CPAN


L<siblings|DBIx::Class::Tree::AdjacencyList/siblings>

=item *

L<attach_sibling|DBIx::Class::Tree::AdjacencyList/attach_sibling>

=item *

L<is_leaf|DBIx::Class::Tree::AdjacencyList/is_leaf>

=item *

L<is_root|DBIx::Class::Tree::AdjacencyList/is_root>

=item *

L<is_branch|DBIx::Class::Tree::AdjacencyList/is_branch>

=back

=cut

# define parent column

__PACKAGE__->parent_column('parent_id');

=head1 RELATIONS

=head2 active_children

Related object: L<Interchange6::Schema::Result::Navigation>

Conditions: self.parent_id = foreign.navigation_id && foreign.active = 1

=cut

has_many
  active_children => "Interchange6::Schema::Result::Navigation",
  sub {
    my $args = shift;

    return {
        "$args->{foreign_alias}.parent_id" =>
          { -ident => "$args->{self_alias}.navigation_id" },
        "$args->{foreign_alias}.active" => 1,
    };
  };

=head2 media_navigations

Type: has_many

Related object: L<Interchange6::Schema::Result::MediaNavigation>

=cut

has_many
  media_navigations => "Interchange6::Schema::Result::MediaNavigation",
  "navigation_id",
  { cascade_copy => 0, cascade_delete => 0 };


=head2 navigation_products

Type: has_many

Related object: L<Interchange6::Schema::Result::NavigationProduct>

=cut

has_many
  navigation_products => "Interchange6::Schema::Result::NavigationProduct",
  "navigation_id",
  { cascade_copy => 0, cascade_delete => 0 };

=head2 products

Type: many_to_many

Accessor to related product results ordered by priority and name.

=cut

many_to_many
  products => "navigation_products",
  "product", { order_by => [ 'product.priority', 'product.name' ] };

=head2 navigation_attributes

Type: has_many

Related object: L<Interchange6::Schema::Result::NavigationAttribute>

=cut

has_many
  navigation_attributes => "Interchange6::Schema::Result::NavigationAttribute",
  "navigation_id",
  { cascade_copy => 0, cascade_delete => 0 };

=head2 attributes

Type: many_to_many

Accessor to related attribute results.

=cut

many_to_many
  attributes => "navigation_attributes", "attribute";

=head2 navigation_messages

Type: has_many

Related object: L<Interchange6::Schema::Result::NavigationMessage>

=cut

has_many
  navigation_messages => "Interchange6::Schema::Result::NavigationMessage",
  "navigation_id", { cascade_copy => 0 };

=head2 messages

Type: many_to_many

Accessor to related Message results.

=cut

many_to_many messages => "navigation_messages", "message";

1;



( run in 0.586 second using v1.01-cache-2.11-cpan-39bf76dae61 )