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
d0fc987f
Commit
d0fc987f
authored
Nov 30, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test break
parent
ff52f28d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
+8
-5
ActiveRecord.php
extensions/redis/ActiveRecord.php
+2
-1
ActiveRelationTrait.php
framework/yii/db/ActiveRelationTrait.php
+2
-2
DbFixtureManager.php
framework/yii/test/DbFixtureManager.php
+2
-1
UniqueValidator.php
framework/yii/validators/UniqueValidator.php
+2
-1
No files found.
extensions/redis/ActiveRecord.php
View file @
d0fc987f
...
...
@@ -9,6 +9,7 @@ namespace yii\redis;
use
yii\base\InvalidConfigException
;
use
yii\base\NotSupportedException
;
use
yii\db\BaseActiveRecord
;
use
yii\helpers\StringHelper
;
/**
...
...
@@ -34,7 +35,7 @@ use yii\helpers\StringHelper;
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
ActiveRecord
extends
\yii\db\
ActiveRecord
class
ActiveRecord
extends
Base
ActiveRecord
{
/**
* Returns the database connection used by this AR class.
...
...
framework/yii/db/ActiveRelationTrait.php
View file @
d0fc987f
...
...
@@ -104,7 +104,7 @@ trait ActiveRelationTrait
if
(
count
(
$primaryModels
)
===
1
&&
!
$this
->
multiple
)
{
$model
=
$this
->
one
();
foreach
(
$primaryModels
as
$i
=>
$primaryModel
)
{
if
(
$primaryModel
instanceof
ActiveRecord
)
{
if
(
$primaryModel
instanceof
ActiveRecord
Interface
)
{
$primaryModel
->
populateRelation
(
$name
,
$model
);
}
else
{
$primaryModels
[
$i
][
$name
]
=
$model
;
...
...
@@ -123,7 +123,7 @@ trait ActiveRelationTrait
foreach
(
$primaryModels
as
$i
=>
$primaryModel
)
{
$key
=
$this
->
getModelKey
(
$primaryModel
,
$link
);
$value
=
isset
(
$buckets
[
$key
])
?
$buckets
[
$key
]
:
(
$this
->
multiple
?
[]
:
null
);
if
(
$primaryModel
instanceof
ActiveRecord
)
{
if
(
$primaryModel
instanceof
ActiveRecord
Interface
)
{
$primaryModel
->
populateRelation
(
$name
,
$value
);
}
else
{
$primaryModels
[
$i
][
$name
]
=
$value
;
...
...
framework/yii/test/DbFixtureManager.php
View file @
d0fc987f
...
...
@@ -11,6 +11,7 @@ use Yii;
use
yii\base\Component
;
use
yii\base\InvalidConfigException
;
use
yii\db\ActiveRecord
;
use
yii\db\ActiveRecordInterface
;
use
yii\db\Connection
;
/**
...
...
@@ -92,7 +93,7 @@ class DbFixtureManager extends Component
foreach
(
$fixtures
as
$name
=>
$fixture
)
{
if
(
strpos
(
$fixture
,
'\\'
)
!==
false
)
{
$model
=
new
$fixture
;
if
(
$model
instanceof
ActiveRecord
)
{
if
(
$model
instanceof
ActiveRecord
Interface
)
{
$this
->
_modelClasses
[
$name
]
=
$fixture
;
$fixtures
[
$name
]
=
$model
->
getTableSchema
()
->
name
;
}
else
{
...
...
framework/yii/validators/UniqueValidator.php
View file @
d0fc987f
...
...
@@ -10,6 +10,7 @@ namespace yii\validators;
use
Yii
;
use
yii\base\InvalidConfigException
;
use
yii\db\ActiveRecord
;
use
yii\db\ActiveRecordInterface
;
/**
* UniqueValidator validates that the attribute value is unique in the corresponding database table.
...
...
@@ -67,7 +68,7 @@ class UniqueValidator extends Validator
$query
=
$className
::
find
();
$query
->
where
([
$attributeName
=>
$value
]);
if
(
!
$object
instanceof
ActiveRecord
||
$object
->
getIsNewRecord
())
{
if
(
!
$object
instanceof
ActiveRecord
Interface
||
$object
->
getIsNewRecord
())
{
// if current $object isn't in the database yet then it's OK just to call exists()
$exists
=
$query
->
exists
();
}
else
{
...
...
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