0

I'm working on an old project and I need to add modules.I want to display some data in my templates.. In my model,I tried

public function getOverdues() {
    $q = Doctrine_Query::create()
    ->select('a.firstname,a.lastname')
    ->from('Applicants a')
    ->leftJoin('a.Loans l')
    ->where('l.is_completed=?','N')
    ->limit(10);
    echo "<h1>Sample Doctrine to SQL For Project</h1>";
    return $q->execute();
    echo "<h1>End of the Script </h1>";*/

}

In my action:

public function executeOverdue(sfWebRequest $r)
{
$applicants = Doctrine_core::getTable('Applicants')->getOverdues();
//$this->setLayout(false);
}

and templates..

<table class="table table-bordered table-condensed table-striped">
<thead>
    <tr>
        <td>Firstname</td>
        <td>Lastname</td>
    </tr>
</head>
<tbody>
    <tr>
        <?php foreach($applicants as $app): ?>
        <th><?php echo $app->firstname ?></th>
        <th><?php echo $app->lastname ?></th>
        <?php endforeach; ?>
    </tr>
</tbody>

This will only display the table with firstname and lastname rows and not diplaying the value.. I can tried (print_r($applicants->toArray());) to test and it successfully print arrays. What I am lacking in my action/templates?

1 Answers1

0

Got it!Just some few modification in my actions

public function executeOverdue(sfWebRequest $r)
{
$this->applicants = Doctrine_core::getTable('Applicants')->getOverdues();
//$this->setLayout(false);
}

Forgot to use '$this'.