我正在研究symfony 1.0中的项目 我在动作文件中创建了结果集,如下所示
$perform = new Criteria();
$perform->clearSelectColumns();
$perform->addSelectColumn(ProductionPeer::PREVIEW_DATE);
$perform->addSelectColumn(ProductionPeer::OPENED);
$perform->addSelectColumn(ProductionPeer::CLOSED);
$perform->addSelectColumn(ProductionPeer::PERFORMANCES);
$perform->addSelectColumn(VenuePeer::NAME);
$perform->addJoin(ProductionPeer::VENUE_ID, VenuePeer::ID, Criteria::LEFT_JOIN);
$perform->add(ProductionPeer::TITLE_ID,3);
$this->performRsCnt = ProductionPeer::doCount($perform);
if($this->performRsCnt > 0)
{
$this->performRs = ProductionPeer::doSelectRS($perform);
$this->performRs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
}
当我执行print_r($ this-> performRs)时,它会提供所需的输出
现在问题是我创建了一个包含在成功文件中的pratial文件,在部分文件中包含了部分文件中包含的组件。当我打印我的动作对象,即$ performRs之前包含组件代码然后它给出了所需的输出,但是当我在包含代码后打印时,它会被组件中的最后一个结果集覆盖
下面是组件的示例代码
组件文件代码
class defaultComponents extends sfComponents
{
public function executeMediaDetail()
{
$mediaHardeep = new Criteria();
$mediaHardeep->addSelectColumn(PhotosPeer::PHOTO);
$mediaHardeep->addSelectColumn(PhotosConcernsPeer::PHOTOS_ID);
$mediaHardeep->addJoin(PhotosConcernsPeer::PHOTOS_ID, PhotosPeer::ID, Criteria::LEFT_JOIN);
$mediaHardeep->add(PhotosConcernsPeer::REF_ID, $this->ref_id);
$mediaHardeep->add(PhotosConcernsPeer::TYPE, $this->type);
$imgRsCntHardeep = PhotosConcernsPeer::doCount($mediaHardeep);
}
}
组件包含部分
中的代码<?php print_r($performRs);?> //desired output
<!-- start media section -->
<?php include_component('default', 'mediaDetail',array('ref_id' => $titleData['ID'], 'type' => 'title','abc123'=>$abcRs));?>
<!-- end media section -->
<?php print_r($performRs);?> //gives the output of $imgRsCntHardeep which is in component
我已经多次检查了我的代码,并且我确保代码不包含任何类型的错误,例如变量不匹配,将变量传递给partial或component,多次使用变量名。 我希望我能从这里找到解决方案,因为我从星期六开始解决这个问题