@@ -57,16 +57,24 @@ class ContentType
5757 /**
5858 * @var Collection|Taxonomy[]
5959 *
60- * @OneToMany(targetEntity="Taxonomy", mappedBy="contentType")
60+ * @OneToMany(targetEntity="Taxonomy", mappedBy="contentType", cascade={"persist"} )
6161 */
6262 private $ taxonomy ;
6363
64+ /**
65+ * @var \Doctrine\Common\Collections\Collection|File[]
66+ *
67+ * @@OneToMany(targetEntity="File", mappedBy="contentType")
68+ */
69+ private $ files ;
70+
6471 /**
6572 * ContentType constructor.
6673 */
6774 public function __construct ()
6875 {
6976 $ this ->taxonomy = new ArrayCollection ();
77+ $ this ->files = new ArrayCollection ();
7078 }
7179
7280 /**
@@ -101,6 +109,11 @@ public function getName()
101109 return $ this ->name ;
102110 }
103111
112+ public function setName ($ name )
113+ {
114+ $ this ->name = $ name ;
115+ }
116+
104117 /**
105118 * @return string
106119 */
@@ -109,6 +122,11 @@ public function getPath()
109122 return $ this ->path ;
110123 }
111124
125+ public function setPath ($ path )
126+ {
127+ $ this ->path = $ path ;
128+ }
129+
112130 /**
113131 * @return string
114132 */
@@ -117,6 +135,11 @@ public function getTemplate()
117135 return $ this ->template ;
118136 }
119137
138+ public function setTemplate ($ template )
139+ {
140+ $ this ->template = $ template ;
141+ }
142+
120143 /**
121144 * @return string
122145 */
@@ -125,6 +148,11 @@ public function getPermalink()
125148 return $ this ->permalink ;
126149 }
127150
151+ public function setPermalink ($ permalink )
152+ {
153+ $ this ->permalink = $ permalink ;
154+ }
155+
128156 /**
129157 * @return boolean
130158 */
@@ -133,6 +161,11 @@ public function getEnabled()
133161 return $ this ->enabled ;
134162 }
135163
164+ public function setEnabled ($ enabled )
165+ {
166+ $ this ->enabled = $ enabled ;
167+ }
168+
136169 /**
137170 * @return Environment
138171 */
@@ -181,4 +214,35 @@ public function removeTaxonomy(Taxonomy $taxonomy)
181214
182215 $ this ->taxonomy ->removeElement ($ taxonomy );
183216 }
217+
218+ public function getFiles ()
219+ {
220+ return $ this ->files ;
221+ }
222+
223+ /**
224+ * @param File $file
225+ */
226+ public function addFile (File $ file )
227+ {
228+ if ($ this ->files ->contains ($ file )) {
229+ return ;
230+ }
231+
232+ $ this ->files ->add ($ file );
233+ //$file->setContentType($this);
234+ }
235+
236+ /**
237+ * @param File $file
238+ */
239+ public function removeFile (File $ file )
240+ {
241+ if (!$ this ->files ->contains ($ file )) {
242+ return ;
243+ }
244+
245+ $ this ->files ->removeElement ($ file );
246+ }
247+
184248}
0 commit comments