You can get the raw value in template (don't absue of it) :
$rawValue = $add->getRawValue();
and then do your tests :
if ($rawValue instanceof myClass)
{
//...
}
Alex'
2009/11/28 Patrick NDJIENTCHEU <[email protected]>
> Hi symfony people,
> I have an issue that is quite annoying.
> My environment is symfony 1.2 and propel.
> I have a model where I have implemented inheritance using the single-table
> strategy. So, here is an excerpt of my model:
> *Ad* (id, posted_date, description)
> then *RealEstateAd*(location, price, transaction_type) and *JobAd*(position,
> requirements, company) which inherit both from *Ad*.
>
> I would like to display all ads, but I would like to display a RealEstateAd
> differently from a JobAd. To achieve this, I've used a partial for a
> RealEstaeAd and a partial for a JobAd.
> So, in the action, I did this:
> *$c = new Criteria();*
> *$this->allAds = AdPeer::doSelect($c);*
>
> In the template, I did:
>
> *<?php foreach ( $allAds as $ad):?>*
> *<?php*
> *
> *
> * if ($add instanceof RealEstateAdd){*
> * include_partial('shortViewRealEstateAd', array("add" => $ad));*
> * }*
> * if ($add instanceof JobAd) {*
> * include_partial('shortViewJobAd', array("ad" => $ad));*
> * }*
> *?>*
> *<hr/>*
> *<?php endforeach; ?>*
>
> The problem is that class of an object in the $allAds array is
> sfOutputEscaperObjectDecorator.
> So, nothing is displayed at all.
> *
> *
> How could I deal with this issue? is there a way to get an array with
> objects which are actually of the class RealEstateAd or JobAd? How is the
> hydrating process carried out here?
>
>
> Many thanks for your help.
>
> --
> -------------------------------------------------------
> NDJIENTCHEU NGANDJUI Patrick
> Software Engineer
>
> ---------------------------------------------------------
> "To live is to choose. But to choose well, you must know who you are and
> what you stand for, where you want to go and why you want to get there."
> Kofi Annan
>
> --
> 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]<symfony-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en.
>
--
Alexandre Salomé -- [email protected]
--
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.