From: Allen Day Date: Mon, 13 Oct 2003 19:44:33 +0000 (+0000) Subject: instantiate linked objects as necessary X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa93031acde8177f6bb739a1c2e22a2ba05855fd;p=dbsrgits%2FSQL-Translator.git instantiate linked objects as necessary --- diff --git a/lib/SQL/Translator/Producer/Turnkey.pm b/lib/SQL/Translator/Producer/Turnkey.pm index 7b72866..0a5dc8e 100644 --- a/lib/SQL/Translator/Producer/Turnkey.pm +++ b/lib/SQL/Translator/Producer/Turnkey.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::Turnkey; # ------------------------------------------------------------------- -# $Id: Turnkey.pm,v 1.1.2.5 2003-10-12 02:08:22 boconnor Exp $ +# $Id: Turnkey.pm,v 1.1.2.6 2003-10-13 19:44:33 allenday Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Allen Day , # Ying Zhang @@ -23,7 +23,7 @@ package SQL::Translator::Producer::Turnkey; use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.1.2.5 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.1.2.6 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use SQL::Translator::Schema::Constants; @@ -451,10 +451,11 @@ use base qw(Class::DBI::Pg); Turnkey::Model::DBI->set_db('Main', '[% db_str %]', '[% db_user %]', '[% db_pass %]'); +sub search_ilike { shift->_do_search(ILIKE => @_) } + [% FOREACH package = packages %] [% printPackage(package.value) %] [% END %] -EOF my $turnkey_xml_tt2 = < @@ -543,6 +544,11 @@ my $turnkey_template_tt2 = <<'EOF'; [% END %] +[% BLOCK make_linked_dbobject %] + [% PERL %] + $stash->set(linked_dbobject => [% class %]->retrieve([% id %])); + [% END %] +[% END %] [% MACRO obj2link(obj) SWITCH ref(obj) %] [% CASE '' %] [% obj %] @@ -553,6 +559,12 @@ my $turnkey_template_tt2 = <<'EOF'; [% CASE DEFAULT %] /?id=[% obj %];class=[% ref(obj) %] [% END %] +[% MACRO obj2desc(obj) SWITCH ref(obj) %] + [% CASE '' %] + [% obj %] + [% CASE DEFAULT %] + [% obj %] +[% END %] [% MACRO renderatom(atom, dbobject) SWITCH atom.name %] [- FOREACH package = linkable -] [% CASE '[- package.key FILTER ucfirst -]' %] @@ -587,11 +599,14 @@ my $turnkey_template_tt2 = <<'EOF'; [% rowcount = rowcount + 1 %] [% END %] [% ELSE %] - +
    [% FOREACH record = lstArr %] - [% record.id %]
    + [% class = ref(atom) | replace('::Atom::', '::Model::') %] + [% id = record.id %] + [% PROCESS make_linked_dbobject %] +
  • [% obj2link(linked_dbobject) %]
  • [% END %] - +
[% END %] [% END %] [- END -]