Development

Changeset 8121

You must first sign up to be able to contribute.

Changeset 8121

Show
Ignore:
Timestamp:
03/27/08 20:24:48 (8 months ago)
Author:
hartym
Message:

sfPropelImpersonatorPlugin: custom setters are specifiable

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelImpersonatorPlugin/trunk/lib/sfPropelObjectPeerImpersonator.class.php

    r8120 r8121  
    2525 *         page views, you could return the same structure with sums, avgs and cie 
    2626 *         replacing the value field. Custom related class will be available through  
    27  *         $previousobject->customCamelizedFieldName (property, not method) 
     27 *         $previousobject->customCamelizedFieldName property, or if this field is 
     28 *         specified as custom_related_by=->setterMethod it will fetch relation using 
     29 *         the given method in previous object 
    2830 *   - custom_related_by_reverse: 
    2931 *         If you want to get a relation link back using custom_related_by, specify the 
    3032 *         underscored version of the field making link. sfPopi will call ->setCamelized(...) 
    3133 *         on the customized object. 
     34 *   - alias: 
     35 *         Provides a way to set an alias name for the table. This allows you to select a table 
     36 *         more than once using propel. 
     37 * 
    3238 * 
    3339 * KNOWN PROBLEMS: 
     
    4652{ 
    4753  /** 
    48    * Relation type constants 
    49    */ 
    50   const RELATION_NORMAL  = 1; 
    51   const RELATION_REVERSE = 2; 
    52   const RELATION_I18N    = 3; 
    53   const RELATION_SELF    = 4; 
    54  
    55   /** 
    5654   * Custom SQL query, set by ->setQuery() 
    5755   */ 
     
    357355            assert($index-1>=0); 
    358356 
    359             $rowObjects[$index-1]->{'custom'.sfInflector::camelize($this->getParameter($index, 'custom_related_by'))} = $rowObjects[$index]; 
     357            $method = $this->getParameter($index, 'custom_related_by'); 
     358 
     359            if (substr($method, 0, 2)=='->') 
     360            { 
     361              $rowObjects[$index-1]->{substr($method, 2)}($rowObjects[$index]); 
     362            } 
     363            else 
     364            { 
     365              $rowObjects[$index-1]->{'custom'.$method} = $rowObjects[$index]; 
     366            } 
    360367 
    361368            if (strlen($_field=sfInflector::camelize($this->getParameter($index, 'custom_related_by_reverse'))))