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
7e0c6353
Commit
7e0c6353
authored
Sep 22, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimized redis AR insert
parent
ece300ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
7 deletions
+2
-7
ActiveRecord.php
extensions/redis/ActiveRecord.php
+1
-7
CHANGELOG.md
extensions/redis/CHANGELOG.md
+1
-0
No files found.
extensions/redis/ActiveRecord.php
View file @
7e0c6353
...
@@ -120,16 +120,14 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -120,16 +120,14 @@ class ActiveRecord extends BaseActiveRecord
$key
=
static
::
keyPrefix
()
.
':a:'
.
static
::
buildKey
(
$pk
);
$key
=
static
::
keyPrefix
()
.
':a:'
.
static
::
buildKey
(
$pk
);
// save attributes
// save attributes
$setArgs
=
[
$key
];
$setArgs
=
[
$key
];
$delArgs
=
[
$key
];
foreach
(
$values
as
$attribute
=>
$value
)
{
foreach
(
$values
as
$attribute
=>
$value
)
{
// only insert attributes that are not null
if
(
$value
!==
null
)
{
if
(
$value
!==
null
)
{
if
(
is_bool
(
$value
))
{
if
(
is_bool
(
$value
))
{
$value
=
(
int
)
$value
;
$value
=
(
int
)
$value
;
}
}
$setArgs
[]
=
$attribute
;
$setArgs
[]
=
$attribute
;
$setArgs
[]
=
$value
;
$setArgs
[]
=
$value
;
}
else
{
$delArgs
[]
=
$attribute
;
}
}
}
}
...
@@ -137,10 +135,6 @@ class ActiveRecord extends BaseActiveRecord
...
@@ -137,10 +135,6 @@ class ActiveRecord extends BaseActiveRecord
$db
->
executeCommand
(
'HMSET'
,
$setArgs
);
$db
->
executeCommand
(
'HMSET'
,
$setArgs
);
}
}
if
(
count
(
$delArgs
)
>
1
)
{
$db
->
executeCommand
(
'HDEL'
,
$delArgs
);
}
$changedAttributes
=
array_fill_keys
(
array_keys
(
$values
),
null
);
$changedAttributes
=
array_fill_keys
(
array_keys
(
$values
),
null
);
$this
->
setOldAttributes
(
$values
);
$this
->
setOldAttributes
(
$values
);
$this
->
afterSave
(
true
,
$changedAttributes
);
$this
->
afterSave
(
true
,
$changedAttributes
);
...
...
extensions/redis/CHANGELOG.md
View file @
7e0c6353
...
@@ -4,6 +4,7 @@ Yii Framework 2 redis extension Change Log
...
@@ -4,6 +4,7 @@ Yii Framework 2 redis extension Change Log
2.
0.0-rc under development
2.
0.0-rc under development
--------------------------
--------------------------
-
Bug #1311: Fixed storage and finding of
`null`
and boolean values (samdark, cebe)
-
Enh #3520: Added
`unlinkAll()`
-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
-
Enh #3520: Added
`unlinkAll()`
-method to active record to remove all records of a model relation (NmDimas, samdark, cebe)
-
Enh #4048: Added
`init`
event to
`ActiveQuery`
classes (qiangxue)
-
Enh #4048: Added
`init`
event to
`ActiveQuery`
classes (qiangxue)
-
Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
-
Enh #4086: changedAttributes of afterSave Event now contain old values (dizews)
...
...
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