Changeset 7 for LATMOS-Accounts


Ignore:
Timestamp:
02/27/09 21:07:53 (15 years ago)
Author:
nanardon
Message:
  • add function to map canonical field name to internal db name
Location:
LATMOS-Accounts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases.pm

    r6 r7  
    6262    my ($self, $otype) = @_; 
    6363    my $pclass = $self->_load_obj_class($otype) or return; 
    64     $pclass->canonical_fields; 
     64    $pclass->_canonical_fields; 
     65} 
     66 
     67=head2 get_field_name($otype, $c_fields) 
     68 
     69Return the internal fields name for $otype object for 
     70canonical fields $c_fields 
     71 
     72=cut 
     73 
     74sub get_field_name { 
     75    my ($self, $otype, $c_fields) = @_; 
     76    my $pclass = $self->_load_obj_class($otype) or return; 
     77    $pclass->_get_field_name($c_fields); 
    6578} 
    6679 
  • LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Objects.pm

    r6 r7  
    4949} 
    5050 
    51 =head2 canonical_fields 
     51=head2 _canonical_fields 
    5252 
    5353Must return the list of field supported by the object. 
    54  
    55 If exists, _canonicals_fields function is called. 
    5654 
    5755Notice this query will always come from the upstream data base, 
     
    6361=cut 
    6462 
    65 sub canonical_fields {  
     63sub _canonical_fields {  
    6664    my ($self) = @_; 
    67     if ($self->can('_canonical_fields')) { 
    68         $self->_canonical_fields; 
    69     } else { return; } 
     65    return; 
     66} 
     67 
     68=head2 _get_fields_name($field) 
     69 
     70Return the fields name for canonical field $field 
     71 
     72=cut 
     73 
     74sub _get_field_name { 
     75    my ($self, $field) = @_; 
     76    return; 
    7077} 
    7178 
  • LATMOS-Accounts/t/10_bases.t

    r6 r7  
    11use strict; 
    22use warnings; 
    3 use Test::More tests => 12; 
     3use Test::More tests => 13; 
    44 
    55use_ok('LATMOS::Accounts::Bases'); 
     
    1717 
    1818ok(eq_set([ $dummyb->list_canonicals_fields('user') ], []), "Can get canonicals fields"); 
     19ok(!defined( $dummyb->get_field_name('any') ), "can call get_fields_name"); 
    1920ok(!$dummyb->is_transactionnal, 'Dummy driver is not transactionnal'); 
Note: See TracChangeset for help on using the changeset viewer.