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
3db7a075
Commit
3db7a075
authored
Dec 03, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Method "yii\sphinx\ActiveRecord::find()" removed in favour of "BaseActiveRecord::find()".
parent
c9624eee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
32 deletions
+4
-32
ActiveRecord.php
extensions/sphinx/ActiveRecord.php
+0
-27
ActiveRecordTest.php
tests/unit/extensions/sphinx/ActiveRecordTest.php
+4
-5
No files found.
extensions/sphinx/ActiveRecord.php
View file @
3db7a075
...
...
@@ -79,33 +79,6 @@ abstract class ActiveRecord extends BaseActiveRecord
}
/**
* Creates an [[ActiveQuery]] instance for query purpose.
*
* @param mixed $q the query parameter. This can be one of the followings:
*
* - a string: fulltext query by a query string and return the list
* of matching records.
* - an array of name-value pairs: query by a set of column values and return a single record matching all of them.
* - null: return a new [[ActiveQuery]] object for further query purpose.
*
* @return ActiveQuery|ActiveRecord[]|ActiveRecord|null When `$q` is null, a new [[ActiveQuery]] instance
* is returned; when `$q` is a string, an array of ActiveRecord objects matching it will be returned;
* when `$q` is an array, an ActiveRecord object matching it will be returned (null
* will be returned if there is no matching).
* @see createQuery()
*/
public
static
function
find
(
$q
=
null
)
{
$query
=
static
::
createQuery
();
if
(
is_array
(
$q
))
{
return
$query
->
where
(
$q
)
->
one
();
}
elseif
(
$q
!==
null
)
{
return
$query
->
match
(
$q
)
->
all
();
}
return
$query
;
}
/**
* Creates an [[ActiveQuery]] instance with a given SQL statement.
*
* Note that because the SQL statement is already specified, calling additional
...
...
tests/unit/extensions/sphinx/ActiveRecordTest.php
View file @
3db7a075
...
...
@@ -41,10 +41,9 @@ class ActiveRecordTest extends SphinxTestCase
$this
->
assertTrue
(
$articles
[
1
]
instanceof
ArticleIndex
);
// find fulltext
$articles
=
ArticleIndex
::
find
(
'cats'
);
$this
->
assertEquals
(
1
,
count
(
$articles
));
$this
->
assertTrue
(
$articles
[
0
]
instanceof
ArticleIndex
);
$this
->
assertEquals
(
1
,
$articles
[
0
]
->
id
);
$article
=
ArticleIndex
::
find
(
2
);
$this
->
assertTrue
(
$article
instanceof
ArticleIndex
);
$this
->
assertEquals
(
2
,
$article
->
id
);
// find by column values
$article
=
ArticleIndex
::
find
([
'id'
=>
2
,
'author_id'
=>
2
]);
...
...
@@ -168,7 +167,7 @@ class ActiveRecordTest extends SphinxTestCase
$record
=
RuntimeIndex
::
find
([
'id'
=>
2
]);
$record
->
content
=
'Test content with '
.
$query
;
$record
->
save
();
$rows
=
RuntimeIndex
::
find
(
$query
);
$rows
=
RuntimeIndex
::
find
(
)
->
match
(
$query
);
$this
->
assertNotEmpty
(
$rows
);
// updateAll
...
...
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