Changeset 6384 for trunk/prototype/api/controller.php
- Timestamp:
- 06/01/12 15:53:54 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/api/controller.php
r6373 r6384 489 489 490 490 if( $return === false ) 491 return( false );491 return( false ); 492 492 493 493 if( isset($return) ) … … 535 535 } 536 536 537 public static function finalizeCommit( $TX, $params, $original, $method ) 538 { 539 $TX['rollback'] = !!!$params['properties']; 540 541 if( $params['properties'] && is_array($params['properties']) && isset($params['properties']['id']) ) 542 $TX['id'] = $params['properties']['id']; 543 544 self::$tx[ $params['URI']['service'] ][] = array_merge( $TX, $original['URI'], array( 'service' => $params['URI']['service'], 'method' => $method ) ); 545 546 if( isset($commit) && $commit ) 547 { 548 if( !self::call( 'commit', $params['URI'], false, self::$tx[ $params['URI']['service'] ] ) ) 549 self::call( 'rollback', $params['URI'] , false, self::$tx[ $params['URI']['service'] ] ); 550 551 unset( self::$tx[ $params['URI']['service'] ] ); 537 public static function finalizeCommit( $method, $params, $original, $TX = array() ) 538 { 539 if( $TX !== false ) 540 { 541 $TX['rollback'] = !!!$params['properties']; 542 543 if( $params['properties'] && is_array($params['properties']) && isset($params['properties']['id']) ) 544 $TX['id'] = $params['properties']['id']; 545 546 self::$tx[ $params['URI']['service'] ][] = array_merge( $TX, $original['URI'], array( 'service' => $params['URI']['service'], 'method' => $method ) ); 552 547 } 553 548 … … 568 563 569 564 if( isset($params['URI']['concept']) && !self::fire( 'before', $method, $params, $original ) ) 570 return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method ) ); 571 572 565 return( self::finalizeCommit( $method, $params, $original ) ); 573 566 574 567 if( $params && !$params['service'] ) … … 592 585 593 586 if( !self::fire( 'before', $method, $params, $original, true ) ) 594 return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method) );587 return( self::finalizeCommit( $method, $params, $original, isset($TX) ? $TX : false ) ); 595 588 } 596 589 … … 632 625 if( isset($params['URI']['service']) ) 633 626 if( !self::fire( 'after', $method, $params, $original, true ) ) 634 return( !isset($TX) ? empty($params['properties']) ? false : $params['properties'] : self::finalizeCommit( $TX, $params, $original, $method) );627 return( self::finalizeCommit( $method, $params, $original, isset($TX) ? $TX : false ) ); 635 628 636 629 if( isset($URI['concept']) ) … … 641 634 642 635 if( isset( $TX ) ) 643 self::finalizeCommit( $TX, $params, $original, $method ); 636 { 637 self::finalizeCommit( $params, $original, $method, $TX ); 638 639 if( isset($commit) && $commit ) 640 { 641 if( !self::call( 'commit', $params['URI'], false, self::$tx[ $params['URI']['service'] ] ) ) 642 self::call( 'rollback', $params['URI'] , false, self::$tx[ $params['URI']['service'] ] ); 643 644 unset( self::$tx[ $params['URI']['service'] ] ); 645 } 646 } 644 647 } 645 648 catch( Exception $e ) … … 726 729 $URI['id'] = $result['id']; 727 730 728 self::$tx[ $URI['service'] ][ count(self::$tx[ $URI['service'] ]) - 1 ]['order'] = $order; 729 self::$tx[ $URI['service'] ][ count(self::$tx[ $URI['service'] ]) - 1 ]['id'] = $URI['id']; 731 $index = count(self::$tx[ $URI['service'] ]) - 1; 732 733 self::$tx[ $URI['service'] ][ $index ]['order'] = $order; 734 self::$tx[ $URI['service'] ][ $index ]['id'] = $URI['id']; 735 736 if( !isset(self::$tx[ $URI['service'] ][ $index ]['concept']) ) 737 self::$tx[ $URI['service'] ][ $index ]['concept'] = $URI['concept']; 730 738 731 739 foreach( $postpone as $linkTarget => $dt )
Note: See TracChangeset
for help on using the changeset viewer.