Guest User

Untitled

a guest
Jun 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. use DoctrineCommonCollectionsArrayCollection;
  2. use DoctrineORMMappingColumn;
  3. use DoctrineORMMappingTable;
  4. use DoctrineORMMappingEntity;
  5. use DoctrineORMMappingId;
  6. use DoctrineORMMappingGeneratedValue;
  7. use DoctrineORMMappingManyToOne;
  8. use DoctrineORMMappingOneToMany;
  9. use DoctrineORMMappingJoinColumn;
  10.  
  11. use JMSSerializerAnnotation as JMS;
  12.  
  13. /**
  14. * Document
  15. *
  16. * @Table(name="document")
  17. * @Entity(repositoryClass="AcmeBundleDocumentRepository")
  18. */
  19.  
  20. class Document
  21. {
  22.  
  23. /**
  24. * @var string
  25. *
  26. * @Column(name="id", type="string")
  27. * @Id
  28. * @GeneratedValue(strategy="UUID")
  29. */
  30. protected $id;
  31.  
  32. /**
  33. * @var string
  34. * @Column(name="name", type="string", length=255)
  35. */
  36. protected $name;
  37.  
  38. /**
  39. * @var string
  40. * @Column(name="type", type="string", length=255)
  41. */
  42. protected $type;
  43.  
  44. /**
  45. * @var boolean
  46. * @Column(name="has_attachments", type="boolean")
  47. */
  48. protected $hasAttachments;
  49.  
  50. /**
  51. * @ManyToOne(targetEntity="Delivery")
  52. * @JoinColumn(name="delivery_id", referencedColumnName="id", nullable=false)
  53. * @JMSExclude()
  54. */
  55. protected $delivery;
  56.  
  57. /**
  58. * @OneToMany(targetEntity="Extension", mappedBy="document", cascade={"persist","remove"})
  59. **/
  60. protected $extensions;
  61.  
  62. public function __construct()
  63. {
  64. $this->extensions = new ArrayCollection();
  65. }
  66.  
  67. /* getter and setters */
  68.  
  69. }
  70.  
  71. use DoctrineORMMappingTable;
  72. use DoctrineORMMappingEntity;
  73.  
  74. /**
  75. * Note
  76. *
  77. * @Table(name="note")
  78. * @Entity(repositoryClass="NoteRepository")
  79. */
  80. class Note extends Document
  81. {
  82.  
  83. }
  84.  
  85. /**
  86. * @MappedSuperclass
  87. */
  88. class DocumentSuperClass
  89. {
  90. ...
  91. }
  92.  
  93. /**
  94. * @Table(name="document")
  95. * @Entity(repositoryClass="AcmeBundleDocumentRepository")
  96. */
  97. class Document extends DocumentSuperClass
  98. {
  99. ...
  100. }
  101.  
  102. /**
  103. * @Table(name="note")
  104. * @Entity(repositoryClass="NoteRepository")
  105. */
  106. class Note extends DocumentSuperClass
  107. {
  108. ...
  109. }
Add Comment
Please, Sign In to add comment