Why don't you have an `id` column on reservation in your schema? And
which relations are defined in your BaseReservation class?
Doctrine uses singular names for models, have you tried to define the
innerJoin as ->innerJoin('r.ReservationDetail rd'); Because magical
methods are singular too.
In your action, you could just use $this->reservations = $reservations
and they will be available in your template as $reservations (instead
of using $this->setVar();)
You could also debug with `var_dump($reservations->toArray());` in
your action or template...
Gr! Evert
On 24 apr, 06:36, fRAnKEnSTEin <[email protected]> wrote:
> Hi,
>
> 1) I have this DB schema:
>
> Reservation:
> columns:
> name: { type: string(255), notnull: true }
> email: { type: string(255), notnull: true }
> commets: { type: string(500), notnull: true }
>
> ReservationDetail:
> columns:
> reservation_id: { type: integer, notnull: true }
> adults_reserved: { type: string(255), notnull: true }
> childrens_reserved: { type: string(255), notnull: true }
> relations:
> Reservation: { onDelete: CASCADE, local: reservation_id,
> foreign: id, foreignAlias: ReservationDetails }
>
> 2) Here is my query and the setVar:
>
> $q = Doctrine_Query::create()
> ->select('r.id, rd.adults_reserved, rd.childrens_reserved')
> ->from('Reservation r')
> ->innerJoin('r.ReservationDetails rd');
> $q->where('rd.reservation_id = 1');
> $reservations = $q->execute();
>
> $this->setVar("reservations", $reservations);
>
> 3) In my template:
>
> <?php foreach ($reservations as $reservation): ?>
> <?php echo $reservation->adults_reserved?>
> <?php echo $reservation->childrens_reserved?>
> <?php endforeach; ?>
>
> Here i got an error that tells me: ...can't find related
> "adults_reserved"...
>
> My question: How can i access and print those details, what im missing
> here?
>
> Regards
>
> --
> 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
> athttp://groups.google.com/group/symfony-users?hl=en
--
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