0

I am working on project which is in symfony 1.0 I have created result set in action file as follows

$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);
}

when I print_r($this->performRs) in action itself then it gives desired output

Now the problem is I have created one pratial file which is included in success file and in partial file there is component included within partial file. when I print my action object i.e. $performRs before include code for component then it gives desired output but when i print after include code then it overwrite by last result set which is in component

below is sample code for component

component file code

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);
        }
    }

component include code in partial

<?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

I have checked my code multiple times and I assure that code does not contain any type of errors like variable mismatch, passing variable to partial or component, using variable name multiple time. I hope I will find solution from here because I am solving this problem since saturday

Hardeep Pandya
  • 897
  • 1
  • 8
  • 27
  • Your code here is not complete - please include the complete code – Manse Jul 16 '12 at 09:42
  • code is very large so I can not show you whole code. Here is sample of that I have checked else things and all is good problem is object overwrite in component.If I comment propel query in component then it gives desired output – Hardeep Pandya Jul 16 '12 at 09:48
  • the variable **must** be being overwritten ... your first sample of code looks like it belongs in a Model not an action ... paste your code somewhere else (for example [pastebin](http://pastebin.com/)) and include a link to it here – Manse Jul 16 '12 at 09:51
  • http://pastebin.com/RLCaJ1gb here is whole code – Hardeep Pandya Jul 16 '12 at 10:12

0 Answers0