Ignore:
Timestamp:
03/13/12 18:23:02 (12 years ago)
Author:
natan
Message:

Ticket #2434 - Implementacao da repeticao de eventos na agenda e adicao de suporte a relacionamentos 1x1 na API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/api/controller.php

    r5637 r5715  
    2727        static $tx = array(); 
    2828        static $isConcept = array(); 
     29        static $hasOne = array(); 
    2930        static $txID = 0; 
    3031        static $wallet; 
     
    161162            $links = array(); 
    162163            self::$isConcept[ $concept ] = array(); 
     164            self::$hasOne[ $concept ] = array(); 
    163165 
    164166            if( isset(self::$config[ $concept ][ 'model.hasOne' ]) ) 
     
    171173 
    172174                    $links[$linkName] = $target; 
    173                     self::$isConcept[ $concept ][ $linkName ] = true; 
     175                    self::$hasOne[ $concept ][ $linkName ] = true; 
    174176                } 
    175177            if( isset(self::$config[ $concept ][ 'model.depends' ]) ) 
     
    182184 
    183185                    $links[$linkName] = $target; 
     186                    self::$hasOne[ $concept ][ $linkName ] = true; 
    184187                    self::$isConcept[ $concept ][ $linkName ] = true; 
    185188                } 
     
    204207 
    205208            return( isset(self::$isConcept[ $concept ][ $linkName ]) ); 
     209        } 
     210 
     211        public static function hasOne( $concept, $linkName ) 
     212        {  
     213            if( !isset( self::$hasOne[ $concept ] ) ) 
     214                self::links( $concept ); 
     215 
     216            return( isset(self::$hasOne[ $concept ][ $linkName ]) ); 
    206217        } 
    207218 
     
    646657 
    647658                foreach( $postpone as $linkTarget => $dt ) 
     659                { 
     660                      if( Controller::hasOne( $URI['concept'], $linkNames[ $linkTarget ] ) ) 
     661                          $dt = array( $dt ); 
     662 
    648663                      foreach( $dt as $ii => $value ) 
    649664                      { 
     
    655670                          self::put( array( 'concept' => $linkTarget ), $value, &$txIds ); 
    656671                      } 
    657  
     672                } 
    658673                if( $commit ) 
    659674                { 
Note: See TracChangeset for help on using the changeset viewer.