使RokSprocket获取k2项目的视频,但获取未定义的属性错误

I'm bulding my website with joomla, and I'm using RokSprocket to display some featured item on the frongpage. RokSprocket can use k2 as content provider, though it can't fetch k2 item's video. So I tried to modify PHP files but I got an Undefiend property $stdClass::video error. Here's what I do:

 RokSprocket is using function convertRawToItem to convert raw items(in this case k2 items) to RokSprocket items:

     protected function convertRawToItem($raw_item, $dborder = 0)
{
    //$textfield = $this->params->get('k2_articletext_field', '');

    $item = new RokSprocket_Item();

    $item->setProvider($this->provider_name);
    $item->setId($raw_item->id);
    $item->setAlias($raw_item->alias);
    $item->setTitle($raw_item->title);
    $item->setDate($raw_item->created);
    $item->setPublished(($raw_item->published == 1) ? true : false);
    $item->setCategory($raw_item->category_title);
    $item->setHits($raw_item->hits);
    $item->setRating($raw_item->rating);
    $item->setMetaKey($raw_item->metakey);
    $item->setMetaDesc($raw_item->metadesc);
    $item->setMetaData($raw_item->metadata);
    $item->setPublishUp($raw_item->publish_up);
    $item->setPublishDown($raw_item->publish_down);
    ................
    return $item;
 }

and class RokSprocket_item's definition is as follow:

class RokSprocket_Item
.......
{
public function setText($introtext)
{
    $this->text = $introtext;
}
public function getText()
{
    return $this->text;
}....}

RokSprocket is setting its item's value with raw k2 item's corresponding value. Because in K2's own pages, it uses echo $this->item->title and echo $this->item->video and the like to output k2 item's various values, I guess I can use k2 item s video value just as rokSprocket uses k2 item's other value. So I think all I need to do is 1)adding a new "video" value and setVideo/getVideo function to class RokSprocket_item;

protected $video;
    public function setVideo($video)
{
    $this->video = $video;
}
public function getVideo()
{
    return $this->video;
}   

2)in the convertRawToItem function, add

    $item->setVideo($raw_item->video);

3)on the front-end, add

   <?php echo $item->getVideo(); ?>

But the frontpage outputs an error message saying: Undefined property: stdClass::$video in the line where I added "$item->setVideo($raw_item->video);".

What did I do wrong?

I think the error message means $raw_item doesn't have video value, I searched in the PHP files to check when this convertRawToItem is called, and I found this in AbstarctJoomlaBasedProvider.php file:

public function getArticleInfo($id, $raw = false)
{
    /** @var $filer_processor RokCommon_Filter_IProcessor */
    $filer_processor = $this->getFilterProcessor();
    $filer_processor->process(array('id' => array($id)), array(), true);
    $query = $filer_processor->getQuery();
    $db    = JFactory::getDbo();
    $db->setQuery($query);
    $db->query();
    if ($error = $db->getErrorMsg()) {
        throw new RokSprocket_Exception($error);
    }
    $ret = $db->loadObject();
    if ($raw) {
        $ret->preview = $this->_cleanPreview($ret->introtext);
        $ret->editUrl = $this->getArticleEditUrl($id);
        return $ret;
    } else {
        $item          = $this->convertRawToItem($ret);
        $item->editUrl = $this->getArticleEditUrl($id);
        $item->preview = $this->_cleanPreview($item->getText());
        return $item;
    }
}

Now I'm stuck here. What to do next is totally beyond my very limited PHP knowledge, it seems having something to do with database. Any hints or teaching are highly appreciated.

You need to define video as a standard class

$video = new stdClass;