Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
7962dbf6
Commit
7962dbf6
authored
Mar 15, 2019
by
john
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3031
parent
f14e3733
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
common/modules/documentation/controllers/DocumentationListAdminController.php
...entation/controllers/DocumentationListAdminController.php
+13
-2
common/modules/documentation/migrations/m190315_091511_remove_foreighn_key_from_content.php
...tions/m190315_091511_remove_foreighn_key_from_content.php
+29
-0
No files found.
common/modules/documentation/controllers/DocumentationListAdminController.php
View file @
7962dbf6
...
@@ -213,13 +213,24 @@ class DocumentationListAdminController extends AdminController
...
@@ -213,13 +213,24 @@ class DocumentationListAdminController extends AdminController
*/
*/
public
function
actionDelete
(
$id
)
public
function
actionDelete
(
$id
)
{
{
$model
=
$this
->
findModel
(
$id
);
$items
=
\common\modules\documentation\models\DocContent
::
find
()
->
where
([
'list_id'
=>
$id
])
->
all
();
$items
=
\common\modules\documentation\models\DocContent
::
find
()
->
where
([
'list_id'
=>
$id
])
->
all
();
foreach
(
$items
as
$item
)
{
foreach
(
$items
as
$item
)
{
$item
->
list_id
=
null
;
$item
->
list_id
=
null
;
$item
->
save
();
$item
->
save
();
}
}
$children
=
DocList
::
find
()
->
where
([
'parent_id'
=>
$id
])
->
all
();
foreach
(
$children
as
$child
)
{
$last
=
DocList
::
find
()
->
where
([
'='
,
'parent_id'
,
(
int
)
$model
->
parent_id
])
->
andWhere
([
'!='
,
'id'
,
$model
->
id
])
->
orderBy
([
'position'
=>
SORT_DESC
])
->
one
();
$child
->
position
=
$last
?
$last
->
position
+
1
:
0
;
$child
->
parent_id
=
$model
->
parent_id
;
$child
->
save
();
}
$
this
->
findModel
(
$id
)
->
delete
();
$
model
->
delete
();
return
$this
->
redirect
([
'manage'
]);
return
$this
->
redirect
([
'manage'
]);
}
}
...
...
common/modules/documentation/migrations/m190315_091511_remove_foreighn_key_from_content.php
0 → 100644
View file @
7962dbf6
<?php
use
yii\db\Migration
;
/**
* Class m190315_091511_remove_foreighn_key_from_content
*/
class
m190315_091511_remove_foreighn_key_from_content
extends
Migration
{
/**
* {@inheritdoc}
*/
public
function
safeUp
()
{
$this
->
dropForeignKey
(
'fk_doc_content_doc_list'
,
'doc_content'
);
}
/**
* {@inheritdoc}
*/
public
function
safeDown
()
{
$this
->
addForeignKey
(
'fk_doc_content_doc_list'
,
'doc_content'
,
'list_id'
,
'doc_list'
,
'id'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment