Hi there,

I've got something really strange that never happened to me before.

I have 2 different queries querying on the same tables. One table is
called 'Module' and the other one 'Section'. A module can have several
sections and a section can belongs to several modules. Therefore, in
my templates, I call module->getSections(). This is where the problem
is.
**************
In my actions.class.php I have:
**************

$this->modules_in = Doctrine_Query::create()
      ->from('Module m')
      ->innerJoin('m.Sections s')
      ->innerJoin('s.SectionUser su')
      ->innerJoin('m.Program p')
      ->where('p.id = ? AND su.user_id = ?', array($request-
>getParameter('program_id'), $user->getId()))
      ->execute();

$this->modules_not_in = Doctrine_Query::create()
     ->from('Module m')
     ->innerJoin('m.Sections s')
     ->innerJoin('m.Program p')
     ->where('p.id = ?', array($request->getParameter('program_id')))
     ->execute();

(I know that the 2nd query is not correct but I made it simpler just
to try to find where the bug is)

**************
in my template I have:
**************

<div id="ad_sections_in">
  <h3>List of sections you are enrolled in:</h3>
  <?php if (!count($modules_in)):?>
    <p class="notice">You are not yet enrolled in any section that is
currently running or upcoming for this program.</p>
  <?php else:?>
    <p class="note">Here is the list of your sections that are
currently running or upcoming. You can request to drop some of them.
Be aware that some are
      mandatory.</p>
    <table class="">
      <tbody>
        <?php foreach($modules_in as $module_in) : ?>
        <tr class="ui-widget-content">
          <td>
            <h4 class="ac"><?php echo sprintf('%s - %s',
$module_in['code'], $module_in['name']) ?></h4>
            <table class="list">
              <tbody>
                <?php foreach($module_in->getSections() as
$section) : ?>
                  <tr>
                    <td>
                      <?php echo sprintf('%s - %s - %s',
$section['code'], $section['name'], $section['section']) ?>
                      <a href="<?php echo url_for('@section_info?
code='.$section['code'])?>" id="<?php echo $section['code']?>"
class="view-in-box note alt">view details &raquo;</a>
                    </td>
                    <td>
                      <?php echo link_to('drop <span class="ui-icon ui-
icon-trash">&nbsp;</span>', sprintf('@adddrop_student_action?
do=drop&section_id=%s', $section['id']),'class=fg-button-mini fg-
button ui-state-default fg-button-icon-left comment') ?>
                    </td>
                  </tr>
                <?php endforeach ?>
              </tbody>
            </table>
          </td>
        </tr>
        <?php endforeach ?>
      </tbody>
    </table>
  <?php endif;?>
</div>



The problem is that my $module_in->getSections() doesn't return me the
results according to the 1st query, but according to the 2nd, and I
have no idea why. If I comment the 2nd query in my actions.class.php,
the results are correct, according to the 1st query. If I change the
order of the queries in the actions.class.php the opposite happens: in
my template the $modules_not_in->getSections() will return the results
according to the other query.

Actually I've found that the results are always according to the last
query of my actions.class.php instead of being related to the correct
query.

Do I miss an option somewhere or there is something that I
misunderstood??

Thanks for the help.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to