summaryrefslogtreecommitdiff
path: root/LedgerSMB/Entity.pm
blob: 07b84a6206f5cf9413499ad7d4df88b8519cd3fa (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;