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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
80cc3108
Commit
80cc3108
authored
Mar 05, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated phpdoc references of BaseAR to the interface
fixes #2623
parent
d6692093
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
ActiveRecordInterface.php
framework/db/ActiveRecordInterface.php
+7
-0
BaseActiveRecord.php
framework/db/BaseActiveRecord.php
+11
-10
No files found.
framework/db/ActiveRecordInterface.php
View file @
80cc3108
...
...
@@ -87,6 +87,13 @@ interface ActiveRecordInterface
public
function
getOldPrimaryKey
(
$asArray
=
false
);
/**
* Returns a value indicating whether the given set of attributes represents the primary key for this model
* @param array $keys the set of attributes to check
* @return boolean whether the given set of attributes represents the primary key for this model
*/
public
static
function
isPrimaryKey
(
$keys
);
/**
* Creates an [[ActiveQueryInterface|ActiveQuery]] instance for query purpose.
*
* This method is usually ment to be used like this:
...
...
framework/db/BaseActiveRecord.php
View file @
80cc3108
...
...
@@ -344,7 +344,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
*/
public
function
hasOne
(
$class
,
$link
)
{
/** @var ActiveRecord $class */
/** @var ActiveRecord
Interface
$class */
return
$class
::
createQuery
([
'modelClass'
=>
$class
,
'primaryModel'
=>
$this
,
...
...
@@ -385,7 +385,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
*/
public
function
hasMany
(
$class
,
$link
)
{
/** @var ActiveRecord $class */
/** @var ActiveRecord
Interface
$class */
return
$class
::
createQuery
([
'modelClass'
=>
$class
,
'primaryModel'
=>
$this
,
...
...
@@ -398,7 +398,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
* Populates the named relation with the related records.
* Note that this method does not check if the relation exists or not.
* @param string $name the relation name (case-sensitive)
* @param ActiveRecord|array|null $records the related records to be populated into the relation.
* @param ActiveRecord
Interface
|array|null $records the related records to be populated into the relation.
*/
public
function
populateRelation
(
$name
,
$records
)
{
...
...
@@ -938,7 +938,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
* Returns a value indicating whether the given active record is the same as the current one.
* The comparison is made by comparing the table names and the primary key values of the two active records.
* If one of the records [[isNewRecord|is new]] they are also considered not equal.
* @param ActiveRecord $record record to compare to
* @param ActiveRecord
Interface
$record record to compare to
* @return boolean whether the two active records refer to the same row in the same database table.
*/
public
function
equals
(
$record
)
...
...
@@ -1106,7 +1106,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
* Note that this method requires that the primary key value is not null.
*
* @param string $name the case sensitive name of the relationship
* @param ActiveRecord $model the model to be linked with the current one.
* @param ActiveRecord
Interface
$model the model to be linked with the current one.
* @param array $extraColumns additional column values to be saved into the pivot table.
* This parameter is only meaningful for a relationship involving a pivot table
* (i.e., a relation set with [[ActiveRelationTrait::via()]] or `[[ActiveQuery::viaTable()]]`.)
...
...
@@ -1141,8 +1141,8 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
$columns
[
$k
]
=
$v
;
}
if
(
is_array
(
$relation
->
via
))
{
/** @var $viaClass ActiveRecord */
/** @var $record ActiveRecord */
/** @var $viaClass ActiveRecord
Interface
*/
/** @var $record ActiveRecord
Interface
*/
$record
=
new
$viaClass
();
foreach
(
$columns
as
$column
=>
$value
)
{
$record
->
$column
=
$value
;
...
...
@@ -1193,7 +1193,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
* Otherwise, the foreign key will be set null and the model will be saved without validation.
*
* @param string $name the case sensitive name of the relationship.
* @param ActiveRecord $model the model to be unlinked from the current one.
* @param ActiveRecord
Interface
$model the model to be unlinked from the current one.
* @param boolean $delete whether to delete the model that contains the foreign key.
* If false, the model's foreign key will be set null and saved.
* If true, the model containing the foreign key will be deleted.
...
...
@@ -1221,7 +1221,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
$columns
[
$b
]
=
$model
->
$a
;
}
if
(
is_array
(
$relation
->
via
))
{
/** @var $viaClass ActiveRecord */
/** @var $viaClass ActiveRecord
Interface
*/
if
(
$delete
)
{
$viaClass
::
deleteAll
(
$columns
);
}
else
{
...
...
@@ -1233,6 +1233,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
}
}
else
{
/** @var $viaTable string */
/** @var Command $command */
$command
=
static
::
getDb
()
->
createCommand
();
if
(
$delete
)
{
$command
->
delete
(
$viaTable
,
$columns
)
->
execute
();
...
...
@@ -1265,7 +1266,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
if
(
!
$relation
->
multiple
)
{
unset
(
$this
->
_related
[
$name
]);
}
elseif
(
isset
(
$this
->
_related
[
$name
]))
{
/** @var ActiveRecord $b */
/** @var ActiveRecord
Interface
$b */
foreach
(
$this
->
_related
[
$name
]
as
$a
=>
$b
)
{
if
(
$model
->
getPrimaryKey
()
==
$b
->
getPrimaryKey
())
{
unset
(
$this
->
_related
[
$name
][
$a
]);
...
...
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