X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ex%2Ffancy_example%2FBeerDB%2FDrinker.pm;fp=ex%2Ffancy_example%2FBeerDB%2FDrinker.pm;h=0000000000000000000000000000000000000000;hb=79aa8d27d124d06bf88b2fc0487ae97563b98936;hp=db798fde3323d1af5c2663707a4282b9c7aa60e2;hpb=1c8db728a3fb5adb4f0ea876ea1316457700edf8;p=maypole.git diff --git a/ex/fancy_example/BeerDB/Drinker.pm b/ex/fancy_example/BeerDB/Drinker.pm deleted file mode 100644 index db798fd..0000000 --- a/ex/fancy_example/BeerDB/Drinker.pm +++ /dev/null @@ -1,48 +0,0 @@ -package BeerDB::Drinker; -use strict; -use warnings; - -use Data::Dumper; - -__PACKAGE__->columns('Stringify' => qw/handle/); - -# A drinker is a person but we do not want to select who that person is -# from a list because this is a 1:1 relationship rather than a M:1. -# The no_select option tells AsForm not to bother making a select box - -__PACKAGE__->has_a(person => 'BeerDB::Person', no_select => 1); - -# Drinker drinks many beers at pubs if they are lucky. I like to specify the -# name of the foreign key unless i can control the order that the -# cdbi classes are created. CDBI does not guess very well the fk column. - -#__PACKAGE__->has_many(pints => 'BeerDB::Pint', 'drinker'); - -# When we create a drinker we want to create a person as well -# So tell AsForm to display the person inputs too. - -sub display_columns { qw/person handle/ } -sub list_columns { qw/person handle/ } -# AsForm and templates may check for search_colums when making -#sub search_columns { qw/person handle/ } - -# We need to tweak the cgi inputs a little. -# Since list is where addnew is, override that. -# Person is a has_a rel and AsForm wont make foreign inputs automatically so -# we manually do it. - -sub list : Exported { - my ($self, $r) = @_; - $self->SUPER::list($r); - my %cgi = $self->to_cgi; - $cgi{person} = $self->to_field('person', 'foreign_inputs'); - $r->template_args->{classmetadata}{cgi} = \%cgi; - #$r->template_args->{classmetadata}{search_cgi} = $self->search_inputs; -} - - - - -#sub foreign_input_delimiter { '__IMODDD__'} - -1;