Development

Changeset 12001

You must first sign up to be able to contribute.

Changeset 12001

Show
Ignore:
Timestamp:
10/06/08 21:50:16 (6 years ago)
Author:
dwhittle
Message:

dwhittle: tweaked toString callables for ObjectHelper?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2/lib/helper/ObjectHelper.php

    r11783 r12001  
    7373  { 
    7474    // text method exists? 
    75     if ($text_method && !method_exists($option, $text_method)) 
     75    $method_exists = ($text_method == '__toString') ? method_exists($option, $text_method) : is_callable(array($option, $text_method)); 
     76    if ($text_method && !$method_exists) 
    7677    { 
    7778      throw new sfViewException(sprintf('Method "%s" doesn\'t exist for object of class "%s".', $text_method, _get_class_decorated($option))); 
     
    7980 
    8081    // value method exists? 
    81     if (!method_exists($option, $value_method)) 
     82    $method_exists = ($value_method == '__toString') ? method_exists($option, $value_method) : is_callable(array($option, $value_method)); 
     83    if (!$method_exists) 
    8284    { 
    8385      throw new sfViewException(sprintf('Method "%s" doesn\'t exist for object of class "%s".', $value_method, _get_class_decorated($option))); 
     
    298300 
    299301  // method exists? 
    300   if (!method_exists($object, $method[0])) 
     302  $method_exists = ($method[0] == '__toString') ? method_exists($object, $method[0]) : is_callable(array($object, $method[0])); 
     303  if (!$method_exists) 
    301304  { 
    302305    throw new sfViewException(sprintf('Method "%s" doesn\'t exist for object of class "%s".', $method[0], _get_class_decorated($object))); 
     
    326329  } 
    327330} 
     331