mirror of
https://github.com/e107inc/e107.git
synced 2025-07-16 20:41:27 +02:00
e_model - advanced toString - now accepts second argument - key from the data array
This commit is contained in:
@@ -9,8 +9,8 @@
|
|||||||
* e107 Base Model
|
* e107 Base Model
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/model_class.php,v $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
* $Date: 2009-08-20 13:06:34 $
|
* $Date: 2009-08-21 22:17:59 $
|
||||||
* $Author: secretr $
|
* $Author: secretr $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1010,12 +1010,21 @@ class e_model
|
|||||||
* Convert object data to a string
|
* Convert object data to a string
|
||||||
*
|
*
|
||||||
* @param boolean $AddSlashes
|
* @param boolean $AddSlashes
|
||||||
|
* @param string $key optional, if set method will return corresponding value as a string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function toString($AddSlashes = true)
|
public function toString($AddSlashes = true, $key = null)
|
||||||
{
|
{
|
||||||
|
if (null !== $key)
|
||||||
|
{
|
||||||
|
$value = $this->getData($key);
|
||||||
|
if(is_array($value))
|
||||||
|
{
|
||||||
|
return e107::getArrayStorage()->WriteArray($value, $AddSlashes);
|
||||||
|
}
|
||||||
|
return (string) $value;
|
||||||
|
}
|
||||||
return (string) e107::getArrayStorage()->WriteArray($this->getData(), $AddSlashes);
|
return (string) e107::getArrayStorage()->WriteArray($this->getData(), $AddSlashes);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user