Code Duplication    Length = 11-11 lines in 2 locations

models/Category.php 1 location

@@ 165-175 (lines=11) @@
162
     *
163
     * @return bool
164
     */
165
    public function beforeSave($insert)
166
    {
167
        if (empty($this->newParentId)) {
168
            $this->parentId = null;
169
170
        } elseif (MenuWidget::checkNewParentId($this, $this->newParentId)) {
171
            $this->parentId = (int)$this->newParentId;
172
        }
173
174
        return parent::beforeSave($insert);
175
    }
176
177
    /**
178
     * Reassigning child objects to their new parent after delete the main model record.

models/Page.php 1 location

@@ 255-265 (lines=11) @@
252
     *
253
     * @return bool
254
     */
255
    public function beforeSave($insert)
256
    {
257
        if (empty($this->newParentId)) {
258
            $this->parentId = null;
259
260
        } elseif (MenuWidget::checkNewParentId($this, $this->newParentId)) {
261
            $this->parentId = (int)$this->newParentId;
262
        }
263
264
        return parent::beforeSave($insert);
265
    }
266
267
    /**
268
     * Reassigning child objects to their new parent after delete the main model record.