Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
10cc19d0
Commit
10cc19d0
authored
Oct 31, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #5833: The `message` command fails with a FK constraint error when trying to update messages
parent
2910322b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
+3
-7
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
MessageController.php
framework/console/controllers/MessageController.php
+2
-7
No files found.
framework/CHANGELOG.md
View file @
10cc19d0
...
@@ -15,6 +15,7 @@ Yii Framework 2 Change Log
...
@@ -15,6 +15,7 @@ Yii Framework 2 Change Log
-
Bug #5702: Parenthesis should be automatically added to
`Validator::whenClient`
to avoid js error (mdmunir, qiangxue)
-
Bug #5702: Parenthesis should be automatically added to
`Validator::whenClient`
to avoid js error (mdmunir, qiangxue)
-
Bug #5745: Gii and debug modules may cause 404 exception when the route contains dashes (qiangxue)
-
Bug #5745: Gii and debug modules may cause 404 exception when the route contains dashes (qiangxue)
-
Bug #5780:
`QueryBuilder::batchInsert()`
may cause "undefined index" error (qiangxue)
-
Bug #5780:
`QueryBuilder::batchInsert()`
may cause "undefined index" error (qiangxue)
-
Bug #5833: The
`message`
command fails with a FK constraint error when trying to update messages (qiangxue)
-
Bug: Gii console command help information does not contain global options (qiangxue)
-
Bug: Gii console command help information does not contain global options (qiangxue)
-
Bug:
`yii\web\UrlRule`
was unable to create URLs for rules containing unicode characters (samdark)
-
Bug:
`yii\web\UrlRule`
was unable to create URLs for rules containing unicode characters (samdark)
-
Enh #5223: Query builder now supports selecting sub-queries as columns (qiangxue)
-
Enh #5223: Query builder now supports selecting sub-queries as columns (qiangxue)
...
...
framework/console/controllers/MessageController.php
View file @
10cc19d0
...
@@ -203,10 +203,10 @@ class MessageController extends Controller
...
@@ -203,10 +203,10 @@ class MessageController extends Controller
$db
->
createCommand
()
$db
->
createCommand
()
->
insert
(
$sourceMessageTable
,
[
'category'
=>
$category
,
'message'
=>
$m
])
->
execute
();
->
insert
(
$sourceMessageTable
,
[
'category'
=>
$category
,
'message'
=>
$m
])
->
execute
();
$lastI
d
=
$db
->
getLastInsertID
();
$lastI
D
=
$db
->
getLastInsertID
();
foreach
(
$languages
as
$language
)
{
foreach
(
$languages
as
$language
)
{
$db
->
createCommand
()
$db
->
createCommand
()
->
insert
(
$messageTable
,
[
'id'
=>
$lastI
d
,
'language'
=>
$language
])
->
execute
();
->
insert
(
$messageTable
,
[
'id'
=>
$lastI
D
,
'language'
=>
$language
])
->
execute
();
}
}
}
}
}
}
...
@@ -222,17 +222,12 @@ class MessageController extends Controller
...
@@ -222,17 +222,12 @@ class MessageController extends Controller
->
delete
(
$sourceMessageTable
,
[
'in'
,
'id'
,
$obsolete
])
->
execute
();
->
delete
(
$sourceMessageTable
,
[
'in'
,
'id'
,
$obsolete
])
->
execute
();
echo
"deleted.
\n
"
;
echo
"deleted.
\n
"
;
}
else
{
}
else
{
$last_id
=
$db
->
getLastInsertID
();
$db
->
createCommand
()
$db
->
createCommand
()
->
update
(
->
update
(
$sourceMessageTable
,
$sourceMessageTable
,
[
'message'
=>
new
\yii\db\Expression
(
"CONCAT('@@',message,'@@')"
)],
[
'message'
=>
new
\yii\db\Expression
(
"CONCAT('@@',message,'@@')"
)],
[
'in'
,
'id'
,
$obsolete
]
[
'in'
,
'id'
,
$obsolete
]
)
->
execute
();
)
->
execute
();
foreach
(
$languages
as
$language
)
{
$db
->
createCommand
()
->
insert
(
$messageTable
,
[
'id'
=>
$last_id
,
'language'
=>
$language
])
->
execute
();
}
echo
"updated.
\n
"
;
echo
"updated.
\n
"
;
}
}
}
}
...
...
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