Myco::Entity::SampleEntityBase - a Myco entity class.


Myco documentation Contained in the Myco distribution.

Index


Code Index:

NAME

Top

Myco::Entity::SampleEntityBase - a Myco entity class.

SYNOPSIS

Top

 $obj = Myco::Entity::SampleEntityBase->new;

 # accessor usage
 $obj->set_fooattrib("hello");
 $value = $obj->get_fooattrib;

 $obj->foometh();

DESCRIPTION

Top

This class, along with Myco::Entity::SampleEntity and Myco::Entity::SampleEntityAddress, provide the basis for all tests provided with the core myco system.

LICENSE AND COPYRIGHT

Top

SEE ALSO

Top

Myco::Entity::SampleEntityBase::Test (Myco::Entity::SampleEntityBase::Test), Myco::Entity, Myco (Myco), Tangram, Class::Tangram, myco-mkentity (mkentity)


Myco documentation Contained in the Myco distribution.
package Myco::Entity::SampleEntityBase;

###############################################################################
# $Id: SampleEntityBase.pm,v 1.5 2006/03/19 19:34:07 sommerb Exp $
#
# See license and copyright near the end of this file.
###############################################################################

### Inheritance
use base qw(Myco::Entity);

my $metadata = Myco::Entity::Meta->new
  (
   name => __PACKAGE__,
   synopsis => 'FOO!',
   tangram => { table => 'sample_entity_base' },
   access_list => { rw => 'admin' },
   ui => {
          view => { fields => [qw( color chicken heybud )] }
         }
  );

### Module Dependencies and Compiler Pragma
use warnings;
use strict;


### Object Schema Definition
our $schema =
  {
   fields => {
	      string => {heybud => {},
			},
	     },
  };


$metadata->add_attribute(name => 'color',
			 type => 'string',
                         synopsis => 'Gimme Color',
                         values => [qw(red green blue)],
                         ui => { label => 'BAR!',
                               }
                        );

$metadata->add_attribute(name => 'chicken',
			 type => 'int',
                         values => [0..5],
                         value_labels => {
                                          0 => 'Rhode Island Red',
                                          1 => 'Pullet',
                                          2 => 'Cornish',
                                          3 => 'Leghorn',
                                          4 => 'Hawk',
                                          5 => 'Kentucky Fried',
                                         },
                         ui => { widget => [ 'radio_group' ],
                                 label => 'Yummy'
                               }
                        );


$metadata->activate_class;

1;
__END__