[Catalyst-commits] r12320 - trunk/examples/CatalystAdvent/root/2009/pen

zamolxes at dev.catalyst.perl.org zamolxes at dev.catalyst.perl.org
Sat Dec 12 15:30:49 GMT 2009


Author: zamolxes
Date: 2009-12-12 15:30:49 +0000 (Sat, 12 Dec 2009)
New Revision: 12320

Modified:
   trunk/examples/CatalystAdvent/root/2009/pen/asgraph.pod
Log:
catalyst action generating current project's schema


Modified: trunk/examples/CatalystAdvent/root/2009/pen/asgraph.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2009/pen/asgraph.pod	2009-12-12 11:30:31 UTC (rev 12319)
+++ trunk/examples/CatalystAdvent/root/2009/pen/asgraph.pod	2009-12-12 15:30:49 UTC (rev 12320)
@@ -42,7 +42,28 @@
 
   $translator->translate;
 
+You can even go crazy and make a Catalyst action that generates the
+diagram of the current project's schema:
 
+  sub schema : Local {
+      my ( $self, $c ) = @_;
+
+      my $translator = SQL::Translator->new(
+          parser        => 'SQL::Translator::Parser::DBIx::Class',
+          data          => $c->model('DB')->schema,
+          producer      => 'Diagram',
+          producer_args => {
+              output_type => 'png',
+              title       => 'MyApp Schema',
+          },
+      ) or die SQL::Translator->error;
+
+      $c->res->content_type('image/png');
+      $c->res->body( $translator->translate );
+
+  }
+
+
 =head2 Graph of Controller Present
 
   use CatalystX::Dispatcher::AsGraph;




More information about the Catalyst-commits mailing list