Public Member Functions | Static Public Member Functions | Static Protected Attributes

Robo47_Doctrine_Hydrator_PopoDriver Class Reference

List of all members.

Public Member Functions

 getElement (array $data, $component)
 getElementCollection ($component)

Static Public Member Functions

static getDefaultClassname ()
static getDefaultContainerClassname ()
static getDefaultTypename ()
static setDefaultClassname ($classname)
static setDefaultContainerClassname ($classname)
static setDefaultTypename ($typename)

Static Protected Attributes

static $_classname = 'Robo47_Popo'
static $_containerClassname = 'array'
static $_typename = '__type'

Detailed Description

Definition at line 32 of file PopoDriver.php.


Member Function Documentation

static Robo47_Doctrine_Hydrator_PopoDriver::getDefaultClassname (  )  [static]
Returns:
string

Definition at line 134 of file PopoDriver.php.

Referenced by getElement().

    {
        return self::$_classname;
    }

Here is the caller graph for this function:

static Robo47_Doctrine_Hydrator_PopoDriver::getDefaultContainerClassname (  )  [static]
Returns:
string|null

Definition at line 118 of file PopoDriver.php.

Referenced by getElementCollection().

    {
        return self::$_containerClassname;
    }

Here is the caller graph for this function:

static Robo47_Doctrine_Hydrator_PopoDriver::getDefaultTypename (  )  [static]
Returns:
string

Definition at line 126 of file PopoDriver.php.

Referenced by getElement().

    {
        return self::$_typename;
    }

Here is the caller graph for this function:

Robo47_Doctrine_Hydrator_PopoDriver::getElement ( array $  data,
component 
)
Parameters:
array $data
string $component
Returns:
Object|Robo47_Popo

Definition at line 145 of file PopoDriver.php.

References getDefaultClassname(), and getDefaultTypename().

    {
        $classname = self::getDefaultClassname();

        $popo = new $classname;

        foreach ($data as $key => $value) {
            $popo[$key] = $value;
        }

        $typename = self::getDefaultTypename();

        if (null !== $typename) {
            $popo[$typename] = $component;
        }

        return $popo;
    }

Here is the call graph for this function:

Robo47_Doctrine_Hydrator_PopoDriver::getElementCollection ( component  ) 
Parameters:
string $component
Returns:
array|ArrayObject

Definition at line 169 of file PopoDriver.php.

References getDefaultContainerClassname().

    {
        $containerClass = self::getDefaultContainerClassname();
        if ($containerClass == 'array') {
            $container = array();
        } else {
            $container = new $containerClass;
        }
        return $container;
    }

Here is the call graph for this function:

static Robo47_Doctrine_Hydrator_PopoDriver::setDefaultClassname ( classname  )  [static]
Parameters:
string $classname

Definition at line 67 of file PopoDriver.php.

References Robo47_Core::getType().

    {
        if (!is_string($classname))  {
            $message = 'Invalid type for $classname: ' .
                Robo47_Core::getType($classname);
            throw new Robo47_Doctrine_Hydrator_Exception($message);
        }
        $instance = new $classname;
        if (!$instance instanceof ArrayAccess) {
            throw new Robo47_Doctrine_Hydrator_Exception('Type does not implement ArrayAccess: ' . Robo47_Core::getType($instance));
        }
        self::$_classname = $classname;
    }

Here is the call graph for this function:

static Robo47_Doctrine_Hydrator_PopoDriver::setDefaultContainerClassname ( classname  )  [static]
Parameters:
string $classname

Definition at line 85 of file PopoDriver.php.

References Robo47_Core::getType().

    {
        if (!is_string($classname))  {
            $message = 'Invalid type for $classname: ' .
                Robo47_Core::getType($classname);
            throw new Robo47_Doctrine_Hydrator_Exception($message);
        }
        if (strtolower($classname) != 'array') {
            $instance = new $classname;
            if (!$instance instanceof ArrayAccess) {
                throw new Robo47_Doctrine_Hydrator_Exception('Type does not implement ArrayAccess: ' . Robo47_Core::getType($instance));
            }
        }
        self::$_containerClassname = $classname;
    }

Here is the call graph for this function:

static Robo47_Doctrine_Hydrator_PopoDriver::setDefaultTypename ( typename  )  [static]
Parameters:
string|null $typename

Definition at line 105 of file PopoDriver.php.

References Robo47_Core::getType().

    {
        if(null !== $typename && !is_string($typename)) {
            $message = 'Invalid type for $typename: ' .
                Robo47_Core::getType($typename);
            throw new Robo47_Doctrine_Hydrator_Exception($message);
        }
        self::$_typename = $typename;
    }

Here is the call graph for this function:


Member Data Documentation

Robo47_Doctrine_Hydrator_PopoDriver::$_classname = 'Robo47_Popo' [static, protected]

Definition at line 51 of file PopoDriver.php.

Robo47_Doctrine_Hydrator_PopoDriver::$_containerClassname = 'array' [static, protected]

Definition at line 61 of file PopoDriver.php.

Robo47_Doctrine_Hydrator_PopoDriver::$_typename = '__type' [static, protected]

Definition at line 42 of file PopoDriver.php.


The documentation for this class was generated from the following file: