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 CakePHP 3.3 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
    • Datasource
      • Exception
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Interface ConnectionInterface

This interface defines the methods you can depend on in a connection.

Namespace: Cake\Datasource

Method Summary

  • config() public

    Get the configuration data used to create the connection.

  • configName() public

    Get the configuration name for this connection.

  • disableConstraints() public

    Run an operation with constraints disabled.

  • logQueries() public

    Enables or disables query logging for this connection.

  • logger() public

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

  • 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

config() ¶ public

config(): array

Get the configuration data used to create the 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.

Constraints should be re-enabled after the callback succeeds/fails.

Parameters
callable $operation

The callback to execute within a transaction.

Returns
mixed
Throws
Exception
Will re-throw any exception raised in $callback after rolling back the transaction.

logQueries() ¶ public

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

Enables or disables query logging for this connection.

Parameters
bool|null $enable optional

whether to turn logging on or disable it. Use null to read current value.

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

logger object instance

Returns
object

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

The callback to execute within a transaction.

Returns
mixed
Throws
Exception
Will re-throw any exception raised in $callback after rolling back the transaction.
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