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
2cd0a2cd
Commit
2cd0a2cd
authored
Nov 25, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs
[ci skip]
parent
325fc281
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
ActiveRecord.php
framework/yii/elasticsearch/ActiveRecord.php
+19
-2
Cluster.php
framework/yii/elasticsearch/Cluster.php
+17
-0
Connection.php
framework/yii/elasticsearch/Connection.php
+6
-0
No files found.
framework/yii/elasticsearch/ActiveRecord.php
View file @
2cd0a2cd
...
...
@@ -15,12 +15,29 @@ use yii\helpers\Inflector;
use
yii\helpers\Json
;
use
yii\helpers\StringHelper
;
// TODO handle optimistic lock
/**
* ActiveRecord is the base class for classes representing relational data in terms of objects.
*
* This class implements the ActiveRecord pattern for the fulltext search and data storage
* [elasticsearch](http://www.elasticsearch.org/).
*
* For defining a record a subclass should at least implement the [[attributes()]] method to define
* attributes.
* The primary key (the `_id` field in elasticsearch terms) is represented by `getId()` and `setId()`.
*
* The following is an example model called `Customer`:
*
* ```php
* class Customer extends \yii\elasticsearch\ActiveRecord
* {
* public function attributes()
* {
* return ['id', 'name', 'address', 'registration_date'];
* }
* }
* ```
*
* You may override [[index()]] and [[type()]] to define the index and type this record represents.
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
...
...
framework/yii/elasticsearch/Cluster.php
0 → 100644
View file @
2cd0a2cd
<?php
/**
*
*
* @author Carsten Brandt <mail@cebe.cc>
*/
namespace
yii\elasticsearch
;
use
yii\base\Object
;
class
Cluster
extends
Object
{
// TODO implement http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster.html
}
\ No newline at end of file
framework/yii/elasticsearch/Connection.php
View file @
2cd0a2cd
...
...
@@ -34,6 +34,9 @@ class Connection extends Component
)
);
// http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html#_example_configuring_http_basic_auth
public
$auth
=
[];
// TODO use timeouts
/**
* @var float timeout to use for connection to redis. If not set the timeout set in php.ini will be used: ini_get("default_socket_timeout")
...
...
@@ -92,6 +95,9 @@ class Connection extends Component
*/
public
function
open
()
{
// TODO select one node to be the active one.
foreach
(
$this
->
nodes
as
$key
=>
$node
)
{
if
(
is_array
(
$node
))
{
$this
->
nodes
[
$key
]
=
new
Node
(
$node
);
...
...
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