| Lines 430-435
          sub from_api_mapping {
      
      
        Link Here | 
        
          | 430 |     return $self->{_from_api_mapping}; | 430 |     return $self->{_from_api_mapping}; | 
        
          | 431 | } | 431 | } | 
        
          | 432 |  | 432 |  | 
            
              |  |  | 433 | =head3 new_from_api | 
            
              | 434 |  | 
            
              | 435 |     my $object = Koha::Object->new_from_api; | 
            
              | 436 |     my $object = Koha::Object->new_from_api( $attrs ); | 
            
              | 437 |  | 
            
              | 438 | Creates a new object, mapping the API attribute names to the ones on the DB schema. | 
            
              | 439 |  | 
            
              | 440 | =cut | 
            
              | 441 |  | 
            
              | 442 | sub new_from_api { | 
            
              | 443 |     my ( $class, $params ) = @_; | 
            
              | 444 |  | 
            
              | 445 |     my $self = $class->new; | 
            
              | 446 |     return $self->set_from_api( $params ); | 
            
              | 447 | } | 
            
              | 448 |  | 
            
              | 449 | =head3 set_from_api | 
            
              | 450 |  | 
            
              | 451 |     my $object = Koha::Object->new(...); | 
            
              | 452 |     $object->set_from_api( $attrs ) | 
            
              | 453 |  | 
            
              | 454 | Sets the object's attributes mapping API attribute names to the ones on the DB schema. | 
            
              | 455 |  | 
            
              | 456 | =cut | 
            
              | 457 |  | 
            
              | 458 | sub set_from_api { | 
            
              | 459 |     my ( $self, $from_api_params ) = @_; | 
            
              | 460 |  | 
            
              | 461 |     my $from_api_mapping = $self->from_api_mapping; | 
            
              | 462 |  | 
            
              | 463 |     my $params; | 
            
              | 464 |  | 
            
              | 465 |     while (my ($key, $value) = each %{ $from_api_params } ) { | 
            
              | 466 |         if ( exists $from_api_mapping->{$key} ) { | 
            
              | 467 |             $params->{$from_api_mapping->{$key}} = $value; | 
            
              | 468 |         } | 
            
              | 469 |         else { | 
            
              | 470 |             $params->{$key} = $value; | 
            
              | 471 |         } | 
            
              | 472 |     } | 
            
              | 473 |  | 
            
              | 474 |     return $self->set( $params ); | 
            
              | 475 | } | 
            
              | 476 |  | 
        
          | 433 | =head3 $object->unblessed_all_relateds | 477 | =head3 $object->unblessed_all_relateds | 
        
          | 434 |  | 478 |  | 
        
          | 435 | my $everything_into_one_hashref = $object->unblessed_all_relateds | 479 | my $everything_into_one_hashref = $object->unblessed_all_relateds | 
            
              | 436 | -  |  |  |