All I was saying there is that your:
public function getProduct() {
return $this->ProductId;
}
Sould be something like:
public function getProduct() {
return $this->*product*; // Return a Product, not an id of a Product.
}
On Friday, 4 April 2014 10:29:32 UTC+2, Parsifal wrote:
>
> Thanks Herman,
> A bit confusion in your last email to me as below. If I understood
> correctly in getProduct function it should be something like:
> fuction getProduct($id) {
> return $em->find('Product', $id);
> }
> Right? And this function should be in Product entity class file itself?
> Please clarify if I understood you correctly.
> در 2014 3 20 22:45، "Herman Peeren" <[email protected] <javascript:>>
> نوشت:
>
>> Hmmm was about to finally shut down my computer and saw your last message.*
>> NO!!!* *getProduct() doen't return a ProductId but a Product!!!* That is
>> the essence of why we do this all! In getProduct() you have nothing to do
>> with an id. It's just what the name sais: getProduct() gets a Product,
>> can't be simpler. Idem with getInfo(). The id is only necessary for the
>> mapping. And maybe if you want to find a specific Product outside of this
>> model.
>>
>>
>> On Thursday, 20 March 2014 22:24:51 UTC+1, Parsifal wrote:
>>>
>>> Thanks a lot. Just a quick check with you for sure:
>>> In "X" entity I add this:
>>>
>>> public function getProduct() {
>>> return $this->ProductId;
>>> }
>>>
>>> Then in "Info" entity I have this:
>>>
>>> public function getInfo() {
>>> return $this->ProductId;
>>> }
>>>
>>> Then use with:
>>> $specificX->getProduct()-getInfo();
>>>
>>> Right? Or what these functions should be? I guess getInfo() should be in
>>> Product entity instead of Info entity? If yes, what should be inside the
>>> function that it loads Info entity?
>>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/doctrine-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
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.