model/entity/activity.php
protected function _getObject($config = array())
    {
        $config = new KObjectConfig($config);

        $config->append(array(
            'attributes' => array(),
            'translate'  => true
        ));

        // Process all object sub-properties.
        foreach ($config as $key => $value)
        {
            if ($value instanceof KObjectConfig && $value->object === true) {
                $config->{$key} = $this->_getObject($value);
            }
        }

        if ($config->objectName && !$config->displayName) {
            $config->displayName = $config->objectName;
        }

        if (is_string($config->url)) {
            $config->url = $this->_getRoute($config->url);
        }

        // Make object non-linkable and set it as deleted if related entity is not found.
        if ($config->find && !$this->_findObject($config->find))
        {
            $config->url     = null;
            $config->deleted = true;
        }

        if ($config->image instanceof KObjectConfig)
        {
            if (is_string($config->image->url)) {
                $config->image->url = $this->_getRoute($config->image->url);
            }

            $config->image = $this->getObject('com:activities.activity.medialink', array('data' => $config->image));
        }

        // Cleanup config.
        foreach (array('find', 'object') as $property) {
            unset($config->$property);
        }

        return $this->getObject('com:activities.activity.object', array('data' => $config));
    }
protected function _getObject($config = array())
    {
        $config = new KObjectConfig($config);

        $config->append(array(
            'attributes' => array(),
            'translate'  => true
        ));

        // Process all object sub-properties.
        foreach ($config as $key => $value)
        {
            if ($value instanceof KObjectConfig && $value->object === true) {
                $config->{$key} = $this->_getObject($value);
            }
        }

        if ($config->objectName && !$config->displayName) {
            $config->displayName = $config->objectName;
        }

        if (is_string($config->url)) {
            $config->url = $this->_getRoute($config->url);
        }

        // Make object non-linkable and set it as deleted if related entity is not found.
        if ($config->find && !$this->_findObject($config->find))
        {
            $config->url     = null;
            $config->deleted = true;
        }

        if ($config->image instanceof KObjectConfig)
        {
            if (is_string($config->image->url)) {
                $config->image->url = $this->_getRoute($config->image->url);
            }

            $config->image = $this->getObject('com:activities.activity.medialink', array('data' => $config->image));
        }

        // Cleanup config.
        foreach (array('find', 'object') as $property) {
            unset($config->$property);
        }

        return $this->getObject('com:activities.activity.object', array('data' => $config));
    }
protected function _getObject ( $ config = array ( ) ) { $ config = new KObjectConfig ( $ config ) ; $ config -> append ( array ( 'attributes' => array ( ) , 'translate' => true ) ) ; // Process all object sub-properties. foreach ( $ config as $ key => $ value ) { if ( $ value instanceof KObjectConfig && $ value -> object === true ) { $ config -> { $ key } = $ this -> _getObject ( $ value ) ; } } if ( $ config -> objectName && ! $ config -> displayName ) { $ config -> displayName = $ config -> objectName ; } if ( is_string ( $ config -> url ) ) { $ config -> url = $ this -> _getRoute ( $ config -> url ) ; } // Make object non-linkable and set it as deleted if related entity is not found. if ( $ config -> find && ! $ this -> _findObject ( $ config -> find ) ) { $ config -> url = null ; $ config -> deleted = true ; } if ( $ config -> image instanceof KObjectConfig ) { if ( is_string ( $ config -> image -> url ) ) { $ config -> image -> url = $ this -> _getRoute ( $ config -> image -> url ) ; } $ config -> image = $ this -> getObject ( 'com:activities.activity.medialink' , array ( 'data' => $ config -> image ) ) ; } // Cleanup config. foreach ( array ( 'find' , 'object' ) as $ property ) { unset ( $ config -> $ property ) ; } return $ this -> getObject ( 'com:activities.activity.object' , array ( 'data' => $ config ) ) ; }
Get an activity object

@param array $config An optional configuration array. The configuration array may contain activity object data as
defined by ComActivitiesActivityObjectInterface. Additionally the following parameters may
be passed in the configuration array:
<br><br>
- find (string): the label of an object to look for. If not found the object being created
is set as deleted (with its deleted property set to true) and non-linkable (with its url
property set to null). A call to a _findActivity{Label} method will be attempted for
determining if an object with label as defined by {Label} exists. See
{@link _findActivityActor()} as an example.
<br><br>
- translate (bool): translates displayName property if set to true.
- object (bool): the configuration array may contain arrays which represent configurations
for stacked activity objects. For them to be considered as object configurations, an object
property with its value set to true must be included in the configuration array.

@return ComActivitiesActivityObject The activity object.
Get an activity object