Completed
Pull Request — 4.0 (#3691)
by Kentaro
06:33
created

BlockPosition::getLayout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
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 1
if (!class_exists('\Eccube\Entity\BlockPosition')) {
19
    /**
20
     * BlockPosition
21
     *
22
     * @ORM\Table(name="dtb_block_position")
23
     * @ORM\InheritanceType("SINGLE_TABLE")
24
     * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
25
     * @ORM\HasLifecycleCallbacks()
26
     * @ORM\Entity(repositoryClass="Eccube\Repository\BlockPositionRepository")
27
     */
28
    class BlockPosition extends \Eccube\Entity\AbstractEntity
29
    {
30
        /**
31
         * @var int
32
         *
33
         * @ORM\Column(name="page_id", type="integer", options={"unsigned":true}, nullable=true)
34
         *
35
         * @deprecated
36
         */
37
        private $page_id;
38
39
        /**
40
         * @var int
41
         *
42
         * @ORM\Column(name="section", type="integer", options={"unsigned":true})
43
         * @ORM\Id
44
         * @ORM\GeneratedValue(strategy="NONE")
45
         */
46
        private $section;
47
48
        /**
49
         * @var int
50
         *
51
         * @ORM\Column(name="block_id", type="integer", options={"unsigned":true})
52
         * @ORM\Id
53
         * @ORM\GeneratedValue(strategy="NONE")
54
         */
55
        private $block_id;
56
57
        /**
58
         * @var int
59
         *
60
         * @ORM\Column(name="layout_id", type="integer", options={"unsigned":true})
61
         * @ORM\Id
62
         * @ORM\GeneratedValue(strategy="NONE")
63
         */
64
        private $layout_id;
65
66
        /**
67
         * @var int|null
68
         *
69
         * @ORM\Column(name="block_row", type="integer", nullable=true, options={"unsigned":true})
70
         */
71
        private $block_row;
72
73
        /**
74
         * @var \Eccube\Entity\Block
75
         *
76
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Block", inversedBy="BlockPositions")
77
         * @ORM\JoinColumns({
78
         *   @ORM\JoinColumn(name="block_id", referencedColumnName="id")
79
         * })
80
         */
81
        private $Block;
82
83
        /**
84
         * @var \Eccube\Entity\PageLayout
85
         *
86
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Page", inversedBy="BlockPositions")
87
         * @ORM\JoinColumns({
88
         *   @ORM\JoinColumn(name="page_id", referencedColumnName="id")
89
         * })
90
         *
91
         * @deprecated
92
         */
93
        private $Page;
94
95
        /**
96
         * @var \Eccube\Entity\Layout
97
         *
98
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Layout", inversedBy="BlockPositions")
99
         * @ORM\JoinColumns({
100
         *   @ORM\JoinColumn(name="layout_id", referencedColumnName="id")
101
         * })
102
         */
103
        private $Layout;
104
105
        /**
106
         * Set pageId.
107
         *
108
         * @param int $pageId
109
         *
110
         * @return BlockPosition
111
         *
112
         * @deprecated
113
         */
114
        public function setPageId($pageId)
115
        {
116
            $this->page_id = $pageId;
0 ignored issues
show
Deprecated Code introduced by
The property Eccube\Entity\BlockPosition::$page_id has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
117
118
            return $this;
119
        }
120
121
        /**
122
         * Get pageId.
123
         *
124
         * @return int
125
         *
126
         * @deprecated
127
         */
128
        public function getPageId()
129
        {
130
            return $this->page_id;
0 ignored issues
show
Deprecated Code introduced by
The property Eccube\Entity\BlockPosition::$page_id has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
131
        }
132
133
        /**
134
         * Set section.
135
         *
136
         * @param int $section
137
         *
138
         * @return BlockPosition
139
         */
140
        public function setSection($section)
141
        {
142
            $this->section = $section;
143
144
            return $this;
145
        }
146
147
        /**
148
         * Get section.
149 1
         *
150
         * @return int
151 1
         */
152
        public function getSection()
153 1
        {
154
            return $this->section;
155
        }
156
157
        /**
158
         * Set blockId.
159
         *
160
         * @param int $blockId
161 113
         *
162
         * @return BlockPosition
163 113
         */
164
        public function setBlockId($blockId)
165
        {
166
            $this->block_id = $blockId;
167
168
            return $this;
169
        }
170
171
        /**
172
         * Get blockId.
173 1
         *
174
         * @return int
175 1
         */
176
        public function getBlockId()
177 1
        {
178
            return $this->block_id;
179
        }
180
181
        /**
182
         * Set layoutId.
183
         *
184
         * @param int $layoutId
185
         *
186
         * @return BlockPosition
187
         */
188
        public function setLayoutId($layoutId)
189
        {
190
            $this->layout_id = $layoutId;
191
192
            return $this;
193
        }
194
195
        /**
196
         * Get layoutId.
197 1
         *
198
         * @return int
199 1
         */
200
        public function getLayoutId()
201 1
        {
202
            return $this->layout_id;
203
        }
204
205
        /**
206
         * Set blockRow.
207
         *
208
         * @param int|null $blockRow
209
         *
210
         * @return BlockPosition
211
         */
212
        public function setBlockRow($blockRow = null)
213
        {
214
            $this->block_row = $blockRow;
215
216
            return $this;
217
        }
218
219
        /**
220
         * Get blockRow.
221 1
         *
222
         * @return int|null
223 1
         */
224
        public function getBlockRow()
225 1
        {
226
            return $this->block_row;
227
        }
228
229
        /**
230
         * Set block.
231
         *
232
         * @param \Eccube\Entity\Block|null $block
233
         *
234
         * @return BlockPosition
235
         */
236
        public function setBlock(\Eccube\Entity\Block $block = null)
237
        {
238
            $this->Block = $block;
239
240
            return $this;
241
        }
242
243
        /**
244
         * Get block.
245
         *
246
         * @return \Eccube\Entity\Block|null
247
         */
248
        public function getBlock()
249
        {
250
            return $this->Block;
251
        }
252
253
        /**
254
         * Set layout.
255
         *
256
         * @param \Eccube\Entity\Layout|null $Layout
257
         *
258
         * @return BlockPosition
259
         */
260
        public function setLayout(\Eccube\Entity\Layout $Layout = null)
261
        {
262
            $this->Layout = $Layout;
263
264
            return $this;
265
        }
266
267
        /**
268
         * Get Layout.
269
         *
270
         * @return \Eccube\Entity\Layout|null
271
         */
272
        public function getLayout()
273 1
        {
274
            return $this->Layout;
275 1
        }
276
277 1
        /**
278
         * Set pageLayout.
279
         *
280
         * @param \Eccube\Entity\Page|null $Page
281
         *
282
         * @return BlockPosition
283
         *
284
         * @deprecated
285 117
         */
286
        public function setPage(\Eccube\Entity\Page $Page = null)
287 117
        {
288
            $this->Page = $Page;
0 ignored issues
show
Documentation Bug introduced by
It seems like $Page can also be of type object<Eccube\Entity\Page>. However, the property $Page is declared as type object<Eccube\Entity\PageLayout>. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

    public function __construct($id)
    {
        $this->id = $id;
    }

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
Deprecated Code introduced by
The property Eccube\Entity\BlockPosition::$Page has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
289
290
            return $this;
291
        }
292
293
        /**
294
         * Get pageLayout.
295
         *
296
         * @return PageLayout
297 1
         *
298
         * @deprecated
299 1
         */
300
        public function getPage()
301 1
        {
302
            return $this->Page;
0 ignored issues
show
Deprecated Code introduced by
The property Eccube\Entity\BlockPosition::$Page has been deprecated.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
303
        }
304
    }
305
}
306