Thank you very much!


Benjamin

 

From: [email protected] [mailto:[email protected]] On 
Behalf Of Marco Pivetta
Sent: 21 February 2014 11:12
To: [email protected]
Subject: Re: [doctrine-user] @MappedSuperclass vs plain abstract class

 

Yep, you should still define that as a mapped superclass




Marco Pivetta 

http://twitter.com/Ocramius      

http://ocramius.github.com/

 

On 21 February 2014 12:10, Benjamin Morel <[email protected]> wrote:

Thank you Marco, so @MappedSuperclass is the way to go then?

 

From: [email protected] [mailto:[email protected]] On 
Behalf Of Marco Pivetta
Sent: 21 February 2014 08:16
To: [email protected]
Subject: Re: [doctrine-user] @MappedSuperclass vs plain abstract class

 

This is really just a lucky case based on how the annotation driver works - 
agreed, it is confusing. It works because your properties are "protected"

I suggest you to try the same with XML or YAML mappings - you will see how it 
crashes badly.




Marco Pivetta 

http://twitter.com/Ocramius      

http://ocramius.github.com/

 

On 20 February 2014 23:09, Benjamin Morel <[email protected]> wrote:

Hi,

 

I have created a base class for several entities that share the same 
properties, and I thought that it was a good use case for a @MappedSuperclass:

 
 
 
 
use Doctrine\ORM\Mapping as ORM;
 
 
/**
 * @ORM\MappedSuperclass
 
 
 */
abstract class Invoiceable
{
 
    /**
     * @ORM\ManyToOne(targetEntity="Invoice")
 
 
     * @ORM\JoinColumn(name="invoiceId", referencedColumnName="id")
 
 
     *
     * @var Invoice|null
     */
 
    protected $invoice = null;
 
 
 
    /**
     * @ORM\ManyToOne(targetEntity="CreditNote")
 
 
     * @ORM\JoinColumn(name="creditNoteId", referencedColumnName="id")
 
 
     *
     * @var CreditNote|null
     */
 
    protected $creditNote = null;
 
 
}

However, I was surprised that when removing the @MappedSuperclass annotation, 
it still works as expected.

What is the purpose of @MappedSuperclass superclass then, if it works without?

 

-- 
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] 
<mailto:doctrine-user%[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/groups/opt_out.

 

-- 
You received this message because you are subscribed to a topic in the Google 
Groups "doctrine-user" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/doctrine-user/_pDgQg87uGs/unsubscribe.
To unsubscribe from this group and all its topics, 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/groups/opt_out.

-- 
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] 
<mailto:doctrine-user%[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/groups/opt_out.

 

-- 
You received this message because you are subscribed to a topic in the Google 
Groups "doctrine-user" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/doctrine-user/_pDgQg87uGs/unsubscribe.
To unsubscribe from this group and all its topics, 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/groups/opt_out.

-- 
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/groups/opt_out.

Reply via email to