Interchange6-Schema

 view release on metacpan or  search on metacpan

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

column title => {
    data_type     => "varchar",
    size          => 255,
};

=head2 dynamic

Boolean flag to designate the attribute as being dynamic.

Defaults to false.

=cut

column dynamic => {
    data_type     => "boolean",
    default_value => 0,
};

=head2 priority

Display order priority.

Defaults to 0.

=cut

column priority => {
    data_type     => "integer",
    default_value => 0,
};

=head1 UNIQUE CONSTRAINT

=head2 attributes_name_type

=over 4

=item * L</name>

=item * L</type>

=back

=cut

unique_constraint attributes_name_type => [qw/name type/];

=head1 RELATIONS

=head2 attribute_values

Type: has_many

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

=cut

has_many
  attribute_values => "Interchange6::Schema::Result::AttributeValue",
  { "foreign.attributes_id" => "self.attributes_id" },
  { cascade_copy            => 0, cascade_delete => 0 };

=head2 product_attributes

Type: has_many

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

=cut

has_many
  product_attributes => "Interchange6::Schema::Result::ProductAttribute",
  { "foreign.attributes_id" => "self.attributes_id" },
  { cascade_copy            => 0, cascade_delete => 0 };

=head2 navigation_attributes

Type: has_many

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

=cut

has_many
  navigation_attributes => "Interchange6::Schema::Result::NavigationAttribute",
  { "foreign.attributes_id" => "self.attributes_id" },
  { cascade_copy            => 0, cascade_delete => 0 };

=head1 METHODS

=head2 new

Set default value of L</title> to L</name>.

=cut

sub new {
    my ( $class, $attrs ) = @_;

    $attrs->{title} = $attrs->{name} unless defined $attrs->{title};

    my $new = $class->next::method($attrs);

    return $new;
}

1;



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