summaryrefslogtreecommitdiff
path: root/LedgerSMB/Entity.pm
blob: 4c01b8044df8250df373471cf8a804d4f8b4b703 (plain)
  1. package LedgerSMB::Entity;
  2. use base qw/LedgerSMB::DBObject/;
  3. sub save {
  4. my $self = shift @_;
  5. my $id = @{ $self->exec_method(procname=>'entity_save',
  6. args=>[
  7. $self->{name},
  8. $self->{entity_class},
  9. ]
  10. )};
  11. $self->{id} = shift @{ $id };
  12. return $self->{id};
  13. }
  14. sub get {
  15. my $self = shift @_;
  16. my $hashref = $self->exec_method(procname=>'entity_get', args=>[$self->{id}]);
  17. $self->merge($hashref);
  18. return $self->{id};
  19. }
  20. sub search {
  21. # Shouldn't really be necessary..
  22. # anyway, Search on name.
  23. my $self = shift @_;
  24. my @list = @{ $self->exec_method( procname=>'entity_search',
  25. args=>[
  26. $self->{name}
  27. ]
  28. ) };
  29. }
  30. 1;