Failed Conditions
Push — sf/last-boss ( 98c677...e157b8 )
by Kiyotaka
05:51
created

Page::getCreateDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Entity;
15
16
use Doctrine\ORM\Mapping as ORM;
17
18
if (!class_exists('\Eccube\Entity\Page')) {
19
    /**
20
     * Page
21
     *
22
     * @ORM\Table(name="dtb_page", indexes={@ORM\Index(name="dtb_page_url_idx", columns={"url"})})
23
     * @ORM\InheritanceType("SINGLE_TABLE")
24
     * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
25
     * @ORM\HasLifecycleCallbacks()
26
     * @ORM\Entity(repositoryClass="Eccube\Repository\PageRepository")
27
     */
28
    class Page extends \Eccube\Entity\AbstractEntity
29
    {
30
        // 編集可能フラグ
31
        const EDIT_TYPE_USER = 0;
32
        const EDIT_TYPE_PREVIEW = 1;
33
        const EDIT_TYPE_DEFAULT = 2;
34
35
        // 特定商取引法ページID
36
        const TRADELAW_PAGE_ID = 21;
37
38
        // ご利用規約ページID
39
        const AGREEMENT_PAGE_ID = 19;
40
41
        public function getLayouts()
42
        {
43
            $Layouts = [];
44
            foreach ($this->PageLayouts as $PageLayout) {
45
                $Layouts[] = $PageLayout->getLayout();
46
            }
47
48
            return $Layouts;
49
        }
50
51
        /**
52
         * @var int
53
         *
54
         * @ORM\Column(name="id", type="integer", options={"unsigned":true})
55
         * @ORM\Id
56
         * @ORM\GeneratedValue(strategy="IDENTITY")
57
         */
58
        private $id;
59
60
        /**
61
         * @var string|null
62
         *
63
         * @ORM\Column(name="page_name", type="string", length=255, nullable=true)
64
         */
65
        private $name;
66
67
        /**
68
         * @var string
69
         *
70
         * @ORM\Column(name="url", type="string", length=255)
71
         */
72
        private $url;
73
74
        /**
75
         * @var string|null
76
         *
77
         * @ORM\Column(name="file_name", type="string", length=255, nullable=true)
78
         */
79
        private $file_name;
80
81
        /**
82
         * @var int
83
         *
84
         * @ORM\Column(name="edit_type", type="smallint", options={"unsigned":true,"default":1})
85
         */
86
        private $edit_type = 1;
87
88
        /**
89
         * @var string|null
90
         *
91
         * @ORM\Column(name="author", type="string", length=255, nullable=true)
92
         */
93
        private $author;
94
95
        /**
96
         * @var string|null
97
         *
98
         * @ORM\Column(name="description", type="string", length=255, nullable=true)
99
         */
100
        private $description;
101
102
        /**
103
         * @var string|null
104
         *
105
         * @ORM\Column(name="keyword", type="string", length=255, nullable=true)
106
         */
107
        private $keyword;
108
109
        /**
110
         * @var \DateTime
111
         *
112
         * @ORM\Column(name="create_date", type="datetimetz")
113
         */
114
        private $create_date;
115
116
        /**
117
         * @var \DateTime
118
         *
119
         * @ORM\Column(name="update_date", type="datetimetz")
120
         */
121
        private $update_date;
122
123
        /**
124
         * @var string|null
125
         *
126
         * @ORM\Column(name="meta_robots", type="string", length=255, nullable=true)
127
         */
128
        private $meta_robots;
129
130
        /**
131
         * @var string|null
132
         *
133
         * @ORM\Column(name="meta_tags", type="string", length=4000, nullable=true)
134
         */
135
        private $meta_tags;
136
137
        /**
138
         * @var \Doctrine\Common\Collections\Collection
139
         *
140
         * @ORM\OneToMany(targetEntity="Eccube\Entity\PageLayout", mappedBy="Page", cascade={"persist","remove"})
141
         */
142
        private $PageLayouts;
143
144
        /**
145
         * @var \Eccube\Entity\Page
146
         *
147
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Page")
148
         * @ORM\JoinColumns({
149
         *   @ORM\JoinColumn(name="master_page_id", referencedColumnName="id")
150
         * })
151
         */
152
        private $MasterPage;
153
154
        /**
155
         * Constructor
156
         */
157
        public function __construct()
158
        {
159
            $this->PageLayouts = new \Doctrine\Common\Collections\ArrayCollection();
160
        }
161
162
        /**
163
         * Set id
164
         *
165
         * @return Page
166
         */
167
        public function setId($id)
168
        {
169
            $this->id = $id;
170
171
            return $this;
172
        }
173
174
        /**
175
         * Get id
176
         *
177
         * @return integer
178
         */
179
        public function getId()
180
        {
181
            return $this->id;
182
        }
183
184
        /**
185
         * Set name.
186
         *
187
         * @param string|null $name
188
         *
189
         * @return Page
190
         */
191
        public function setName($name = null)
192
        {
193
            $this->name = $name;
194
195
            return $this;
196
        }
197
198
        /**
199
         * Get name.
200
         *
201
         * @return string|null
202
         */
203
        public function getName()
204
        {
205
            return $this->name;
206
        }
207
208
        /**
209
         * Set url.
210
         *
211
         * @param string $url
212
         *
213
         * @return Page
214
         */
215
        public function setUrl($url)
216
        {
217
            $this->url = $url;
218
219
            return $this;
220
        }
221
222
        /**
223
         * Get url.
224
         *
225
         * @return string
226
         */
227
        public function getUrl()
228
        {
229
            return $this->url;
230
        }
231
232
        /**
233
         * Set fileName.
234
         *
235
         * @param string|null $fileName
236
         *
237
         * @return Page
238
         */
239
        public function setFileName($fileName = null)
240
        {
241
            $this->file_name = $fileName;
242
243
            return $this;
244
        }
245
246
        /**
247
         * Get fileName.
248
         *
249
         * @return string|null
250
         */
251
        public function getFileName()
252
        {
253
            return $this->file_name;
254
        }
255
256
        /**
257
         * Set editType.
258
         *
259
         * @param int $editType
260
         *
261
         * @return Page
262
         */
263
        public function setEditType($editType)
264
        {
265
            $this->edit_type = $editType;
266
267
            return $this;
268
        }
269
270
        /**
271
         * Get editType.
272
         *
273
         * @return int
274
         */
275
        public function getEditType()
276
        {
277
            return $this->edit_type;
278
        }
279
280
        /**
281
         * Set author.
282
         *
283
         * @param string|null $author
284
         *
285
         * @return Page
286
         */
287
        public function setAuthor($author = null)
288
        {
289
            $this->author = $author;
290
291
            return $this;
292
        }
293
294
        /**
295
         * Get author.
296
         *
297
         * @return string|null
298
         */
299
        public function getAuthor()
300
        {
301
            return $this->author;
302
        }
303
304
        /**
305
         * Set description.
306
         *
307
         * @param string|null $description
308
         *
309
         * @return Page
310
         */
311
        public function setDescription($description = null)
312
        {
313
            $this->description = $description;
314
315
            return $this;
316
        }
317
318
        /**
319
         * Get description.
320
         *
321
         * @return string|null
322
         */
323
        public function getDescription()
324
        {
325
            return $this->description;
326
        }
327
328
        /**
329
         * Set keyword.
330
         *
331
         * @param string|null $keyword
332
         *
333
         * @return Page
334
         */
335
        public function setKeyword($keyword = null)
336
        {
337
            $this->keyword = $keyword;
338
339
            return $this;
340
        }
341
342
        /**
343
         * Get keyword.
344
         *
345
         * @return string|null
346
         */
347
        public function getKeyword()
348
        {
349
            return $this->keyword;
350
        }
351
352
        /**
353
         * Set createDate.
354
         *
355
         * @param \DateTime $createDate
356
         *
357
         * @return Page
358
         */
359
        public function setCreateDate($createDate)
360
        {
361
            $this->create_date = $createDate;
362
363
            return $this;
364
        }
365
366
        /**
367
         * Get createDate.
368
         *
369
         * @return \DateTime
370
         */
371
        public function getCreateDate()
372
        {
373
            return $this->create_date;
374
        }
375
376
        /**
377
         * Set updateDate.
378
         *
379
         * @param \DateTime $updateDate
380
         *
381
         * @return Page
382
         */
383
        public function setUpdateDate($updateDate)
384
        {
385
            $this->update_date = $updateDate;
386
387
            return $this;
388
        }
389
390
        /**
391
         * Get updateDate.
392
         *
393
         * @return \DateTime
394
         */
395
        public function getUpdateDate()
396
        {
397
            return $this->update_date;
398
        }
399
400
        /**
401
         * Set metaRobots.
402
         *
403
         * @param string|null $metaRobots
404
         *
405
         * @return Page
406
         */
407
        public function setMetaRobots($metaRobots = null)
408
        {
409
            $this->meta_robots = $metaRobots;
410
411
            return $this;
412
        }
413
414
        /**
415
         * Get metaRobots.
416
         *
417
         * @return string|null
418
         */
419
        public function getMetaRobots()
420
        {
421
            return $this->meta_robots;
422
        }
423
424
        /**
425
         * Set meta_tags
426
         *
427
         * @param string $metaTags
428
         *
429
         * @return Page
430
         */
431
        public function setMetaTags($metaTags)
432
        {
433
            $this->meta_tags = $metaTags;
434
435
            return $this;
436
        }
437
438
        /**
439
         * Get meta_tags
440
         *
441
         * @return string
442
         */
443
        public function getMetaTags()
444
        {
445
            return $this->meta_tags;
446
        }
447
448
        /**
449
         * Get pageLayoutLayout.
450
         *
451
         * @return \Doctrine\Common\Collections\Collection
452
         */
453
        public function getPageLayouts()
454
        {
455
            return $this->PageLayouts;
456
        }
457
458
        /**
459
         * Add pageLayoutLayout
460
         *
461
         * @param \Eccube\Entity\PageLayout $PageLayout
462
         *
463
         * @return Page
464
         */
465
        public function addPageLayout(\Eccube\Entity\PageLayout $PageLayout)
466
        {
467
            $this->PageLayouts[] = $PageLayout;
468
469
            return $this;
470
        }
471
472
        /**
473
         * Remove pageLayoutLayout
474
         *
475
         * @param \Eccube\Entity\PageLayout $PageLayout
476
         */
477
        public function removePageLayout(\Eccube\Entity\PageLayout $PageLayout)
478
        {
479
            $this->PageLayouts->removeElement($PageLayout);
480
        }
481
482
        /**
483
         * Set MasterPage.
484
         *
485
         * @param \Eccube\Entity\Page|null $page
486
         *
487
         * @return Page
488
         */
489
        public function setMasterPage(\Eccube\Entity\Page $page = null)
490
        {
491
            $this->MasterPage = $page;
492
493
            return $this;
494
        }
495
496
        /**
497
         * Get MasterPage.
498
         *
499
         * @return \Eccube\Entity\Page|null
500
         */
501
        public function getMasterPage()
502
        {
503
            return $this->MasterPage;
504
        }
505
506
        /**
507
         * @param $layoutId
508
         *
509
         * @return null|int
510
         */
511
        public function getSortNo($layoutId)
512
        {
513
            $pageLayouts = $this->getPageLayouts();
514
515
            /** @var PageLayout $pageLayout */
516
            foreach ($pageLayouts as $pageLayout) {
517
                if ($pageLayout->getLayoutId() == $layoutId) {
518
                    return $pageLayout->getSortNo();
519
                }
520
            }
521
522
            return null;
523
        }
524
    }
525
}
526