I make a controller action in which i used doctrine odm query for selecting 
data of calendar table but when i print $calendars it does not show data 
how i get data and show using index.phtml?

here is my code:


 <?php
    $calendars = $this->calendars;
    $title = 'Calendars by';
    $this->headTitle($title);
?>

<h3><?php echo $this->escapeHtml($title); ?></h3>

<ul>
    <li><a href="<?php echo $this->url('calendar', 
array('action'=>'create'));?>">Create New Calendar</a></li>
</ul>

<h4>Calendars created by you</h4>

<?php if (is_null($calendars)): ?>

    <p>No calendars</p>

<?php else: ?>
    
    <table class="table">
    <tr>
        <th>calendar name</th>
        <th>description</th>
        <th>actions</th>
    </tr>
    <?php foreach ($calendars as $calendar) : ?>
    <tr>
        <td>
            <a href="<?php echo 
$this->url('calendar',array('action'=>'show', 'id' => 
$calendar->calendar_id));?>">
                    <?php echo $this->escapeHtml($calendar->title);?>
            </a>
        </td>
        <td><?php echo $this->escapeHtml($calendar->description);?></td>
        <td>
            <a href="<?php echo $this->url('calendar',
                array('action'=>'settings', 'id' => 
$calendar->_id));?>">Settings</a>
            <a href="<?php echo $this->url('calendar',
                array('action'=>'delete', 'id' => 
$calendar->_id));?>">delete</a>
        </td>
    </tr>
    <?php endforeach; ?>
    </table>
    
<?php endif; ?>

and here is my controller function:

public function indexAction()
        {           
            $dm = 
$this->getServiceLocator()->get('doctrine.documentmanager.odm_default');
            $qb = 
$dm->createQueryBuilder('Calendar\Document\Calendar')->select('title', 
'description');
            $query = $qb->getQuery();
            $calendars = $query->execute();
            return array('calendars' => $calenders);
        }



-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to