CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C Elastic Search 2.x API

  • Project:
    • Elastic Search
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 2.x
      • 4.x
      • 3.x
      • 2.x

Namespaces

  • Cake\ElasticSearch
    • Association
    • Datasource
      • Log
    • Rule
    • TestSuite
    • View

Class Connection

Namespace: Cake\ElasticSearch\Datasource

Property Summary

  • $_client protected
    Elastica\Client

    Elastica client instance

  • $_esLogger protected
    Cake\ElasticSearch\Datasource\Log\ElasticLogger

    Instance of ElasticLogger

  • $_logger protected
    Cake\Database\Log\QueryLogger|Psr\Log\LoggerInterface

    Logger object instance.

  • $configName protected
    string

    The connection name in the connection manager.

  • $logQueries protected
    bool

    Whether or not query logging is enabled.

Method Summary

  • __call() public

    Pass remaining methods to the elastica client (if they exist) And set the current logger based on current logQueries value

  • __construct() public

    Constructor.

  • beginTransaction() public

    {@inheritDoc}

  • config() public

    Get the config data for this connection.

  • configName() public

    Get the configuration name for this connection.

  • disableConstraints() public

    Run an operation with constraints disabled.

  • disableForeignKeys() public

    {@inheritDoc}

  • disableQueryLogging() public @method
  • disableSavePoints() public @method
  • enableForeignKeys() public

    {@inheritDoc}

  • enableQueryLogging() public @method
  • enabled() public

    {@inheritDoc}

  • execute() public @method
  • getDriver() public @method

    Gets the driver instance.

  • getEsLogger() public

    Return instance of ElasticLogger

  • getLogger() public

    Get the logger object Will set the default logger to elasticsearch if found, or debug If none of the above are found the default Es logger will be used.

  • getSchemaCollection() public

    Returns a SchemaCollection stub until we can add more abstract API's in Connection.

  • isQueryLoggingEnabled() public @method
  • logQueries() public

    Enables or disables query logging for this connection.

  • logger() public deprecated

    Sets the logger object instance. When called with no arguments it returns the currently setup logger instance.

  • newQuery() public @method
  • prepare() public @method
  • query() public @method
  • quote() public @method
  • setLogger() public

    Sets a logger

  • supportsDynamicConstraints() public @method
  • transactional() public

    Executes a callable function inside a transaction, if any exception occurs while executing the passed callable, the transaction will be rolled back If the result of the callable function is false, the transaction will also be rolled back. Otherwise the transaction is committed after executing the callback.

Method Detail

__call() ¶ public

__call(string $name, array $attributes): mixed

Pass remaining methods to the elastica client (if they exist) And set the current logger based on current logQueries value

Parameters
string $name

Method name

array $attributes

Method attributes

Returns
mixed

__construct() ¶ public

__construct(array $config = [], callable $callback = null)

Constructor.

Parameters
array $config optional

config options

callable $callback optional

Callback function which can be used to be notified about errors (for example connection down)

beginTransaction() ¶ public

beginTransaction()

{@inheritDoc}

config() ¶ public

config(): array

Get the config data for this connection.

Returns
array

configName() ¶ public

configName(): string

Get the configuration name for this connection.

Returns
string

disableConstraints() ¶ public

disableConstraints(callable $operation): mixed

Run an operation with constraints disabled.

Elasticsearch does not deal with the concept of foreign key constraints This method just triggers the $operation argument.

Parameters
callable $operation
Returns
mixed

disableForeignKeys() ¶ public

disableForeignKeys()

{@inheritDoc}

disableQueryLogging() ¶ public @method

disableQueryLogging(): $this
Returns
$this

disableSavePoints() ¶ public @method

disableSavePoints(): $this
Returns
$this

enableForeignKeys() ¶ public

enableForeignKeys()

{@inheritDoc}

enableQueryLogging() ¶ public @method

enableQueryLogging(mixed $value): $this
Parameters
$value
Returns
$this

enabled() ¶ public

enabled()

{@inheritDoc}

execute() ¶ public @method

execute(mixed $query, mixed $params = [], array $types = []): Cake\Database\StatementInterface
Parameters
$query
$params optional
array $types optional
Returns
Cake\Database\StatementInterface

getDriver() ¶ public @method

getDriver(): object

Gets the driver instance.

Returns
object

getEsLogger() ¶ public

getEsLogger(): Cake\ElasticSearch\Datasource\Log\ElasticLogger

Return instance of ElasticLogger

Returns
Cake\ElasticSearch\Datasource\Log\ElasticLogger

getLogger() ¶ public

getLogger(): Cake\Database\Log\QueryLogger

Get the logger object Will set the default logger to elasticsearch if found, or debug If none of the above are found the default Es logger will be used.

Returns
Cake\Database\Log\QueryLogger

getSchemaCollection() ¶ public

getSchemaCollection(): Cake\ElasticSearch\Datasource\SchemaCollection

Returns a SchemaCollection stub until we can add more abstract API's in Connection.

Returns
Cake\ElasticSearch\Datasource\SchemaCollection

isQueryLoggingEnabled() ¶ public @method

isQueryLoggingEnabled(): bool
Returns
bool

logQueries() ¶ public

logQueries(bool|null $enable = null): bool

Enables or disables query logging for this connection.

Parameters
bool|null $enable optional
Returns
bool

logger() ¶ public

logger(object|null $instance = null): object

Sets the logger object instance. When called with no arguments it returns the currently setup logger instance.

Parameters
object|null $instance optional
Returns
object

newQuery() ¶ public @method

newQuery(): Cake\Database\Query
Returns
Cake\Database\Query

prepare() ¶ public @method

prepare(mixed $sql): Cake\Database\StatementInterface
Parameters
$sql
Returns
Cake\Database\StatementInterface

query() ¶ public @method

query(string $sql): Cake\Database\StatementInterface
Parameters
string $sql
Returns
Cake\Database\StatementInterface

quote() ¶ public @method

quote(mixed $value, mixed $type = null): string
Parameters
$value
$type optional
Returns
string

setLogger() ¶ public

setLogger(mixed $logger): $this

Sets a logger

Parameters
$logger

Logger instance

Returns
$this

supportsDynamicConstraints() ¶ public @method

supportsDynamicConstraints(): bool
Returns
bool

transactional() ¶ public

transactional(callable $transaction): mixed

Executes a callable function inside a transaction, if any exception occurs while executing the passed callable, the transaction will be rolled back If the result of the callable function is false, the transaction will also be rolled back. Otherwise the transaction is committed after executing the callback.

The callback will receive the connection instance as its first argument.

Parameters
callable $transaction
Returns
mixed

Property Detail

$_client ¶ protected

Elastica client instance

Type
Elastica\Client

$_esLogger ¶ protected

Instance of ElasticLogger

Type
Cake\ElasticSearch\Datasource\Log\ElasticLogger

$_logger ¶ protected

Logger object instance.

Type
Cake\Database\Log\QueryLogger|Psr\Log\LoggerInterface

$configName ¶ protected

The connection name in the connection manager.

Type
string

$logQueries ¶ protected

Whether or not query logging is enabled.

Type
bool
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs