symfony - Access to inherit class attribute from DQL in Symfony2 -


i have abstract class product , inherited class productwithrecurrency:

/**  * @orm\table(name= "product")  * @orm\entity(repositoryclass="acme\storebundle\entity\repositories\productrepository")  * @orm\inheritancetype("joined")  * @orm\discriminatorcolumn(name="product_kind_id", type="integer")  * @orm\discriminatormap({"1" = "productfoo", "2" = "productwithrecurring"})  */ abstract class product {  }   /**  *  * @orm\table(name="product_with_recurring")  * @orm\entity( repositoryclass ="acme\storebundle\entity\repositories\productrepository")  */ class productwithrecurring extends product {     /**      * @var recurring $recurring      *      * @orm\joincolumn(name="recurring_id", referencedcolumnname="id", nullable=false)      */     protected $recurring; } 

i need mixed products , have "recurring" entity information when product instance of productwithrecurring. have method in productrepository dql:

$dql = "select p product         acme\storebundle\entity\product p         left join p.recurring rc         p.some_conditions"; 

obviously exception:

[semantical error] line 0, col 1182 near 'rc ': error: class acme\storebundle\entity\product has no association named recurring 

do should add complexity query or have conceptual error? (i'm no expert in symfony , less in doctrine).

there may errors in code, i've simplified isolate problem.

my english not good, hope understand me, thanks!

you should able access of product atributes in product productwithrecurring.

using code below not work? not quite understand you'd result

$dql = "select p     acme\storebundle\entity\productwithrecurring p     p.some_conditions"; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -