|
Oak::Controller::EntityHelper - Helper module for accessing DBIEntities from Controller |
Oak::Controller::EntityHelper - Helper module for accessing DBIEntities from Controller
# This class do not catch any exception, all the exeptions thrown by the entity classes # will be propagated ######################### # in the controller...
use Oak::Controller::EntityHelper qw(list list_related create purge get_data set_data);
$bag = $self->list ( class => "MyApp::MyDBIEntityClass", query => "LIMIT 10, 10 ORDER BY name" );
$bag = $self->list_related
(
class => "MyApp::MyDBIEntityClass",
keys => {myprimary_key => "my_value"},
query => "LIMIT 10, 10 ORDER BY name",
relationship => "relationship_name"
);
$bag = $self->create
(
class => "MyApp::MyDBIEntityClass",
data => {field1 => "value1"}
);
$bag = $self->purge
(
class => "MyApp::MyDBIEntityClass",
keys => {myprimary_key => "my_value"}
);
$bag = $self->get_data
(
class => "MyApp::MyDBIEntityClass",
keys => {myprimary_key => "my_value"}
);
$bag = $self->set_data
(
class => "MyApp::MyDBIEntityClass",
keys => {myprimary_key => "my_value"},
data => {myfield => "myvalue"}
);
This is a helper module that exports the methods ``list'', ``list_related'', ``get_data'', ``set_data'' and ``count''. Create methods that calls these methods in your controller class.
[
{field1 => "value1",field2 => "value2"},
...
]
[
{field1 => "value1",field2 => "value2"},
...
]
$entity->add_relationship(``Relationship name'', $related);
$entity->remove_relationship(``Relationship name'', $related);
Copyright (c) 2001 Daniel Ruoso <daniel@ruoso.com> Carlos Eduardo de Andrade Brasileiro <eduardo@oktiva.com.br> All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
Oak::Controller::EntityHelper - Helper module for accessing DBIEntities from Controller |