프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$connection | mixed | Stores a connection to a remote resource. Usually a database connection (resource type), or an HTTP connection object ('object' type). |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$_autoConfig | array | The list of object properties to be automatically assigned from configuration passed to __construct(). | |
$_cachedMethods | array | Holds cached methods. | |
$_classes | array | Default entity and set classes used by subclasses of Source. | |
$_isConnected | boolean | Stores the status of this object's connection. Updated when connect() or disconnect() are called, or if an error occurs that closes the object's connection. |
메소드 | 설명 | |
---|---|---|
__construct ( array $config = [] ) : void | Constructor. | |
__destruct ( ) : void | Destructor. Ensures the connection is closed, before the object is destroyed. | |
applyStrategy ( array $options, object $context ) | Applying a strategy to a lithium\data\model\Query object | |
configureClass ( string $class ) : array | A method which can be optionally implemented to configure a model class. | |
connect ( ) | Abstract. Must be defined by child classes. | |
create ( mixed $query, array $options = [] ) : boolean | Create a record. This is the abstract method that is implemented by specific data sources. | |
delete ( mixed $query, array $options = [] ) : boolean | Abstract. Must be defined by child classes. | |
describe ( mixed $entity, array $schema = [], array $meta = [] ) : array | Gets the column schema for a given entity (such as a database table). | |
disconnect ( ) | Abstract. Must be defined by child classes. | |
enabled ( string $feature = null ) : boolean | With no parameter, checks a specific supported feature. | |
isConnected ( array $options = [] ) : boolean | Checks the connection status of this data source. If the 'autoConnect' option is set to true and the source connection is not currently active, a connection attempt will be made before returning the result of the connection status. | |
methods ( ) : array | Returns the list of methods which format values imported from Query objects. Should be overridden in subclasses. | |
name ( string $name ) : string | Quotes data-source-native identifiers, where applicable. | |
read ( mixed $query, array $options = [] ) : boolean | Abstract. Must be defined by child classes. | |
relationFieldName ( $type, $name ) : string | Returns the field name of a relation name (underscore). | |
relationship ( $class, $type, $name, array $options = [] ) : array | Defines or modifies the default settings of a relationship between two models. | |
sources ( string $class = null ) : array | Returns a list of objects (sources) that models can bind to, i.e. a list of tables in the case of a database, or REST collections, in the case of a web service. | |
update ( mixed $query, array $options = [] ) : boolean | Updates a set of records in a concrete data store. |
메소드 | 설명 | |
---|---|---|
_init ( ) |
public __construct ( array $config = [] ) : void | ||
$config | array | Available options are: - `'autoConnect'` _boolean_: If `true`, a connection is made on initialization. Defaults to `true`. |
리턴 | void |
public __destruct ( ) : void | ||
리턴 | void |
public applyStrategy ( array $options, object $context ) | ||
$options | array | The option array |
$context | object | A query object to configure |
public configureClass ( string $class ) : array | ||
$class | string | The name of the model class to be configured. |
리턴 | array | This method should return an array one or more of the following keys: `'meta'`, `'classes'` or `'finders'`. These keys maps to the three corresponding properties in `lithium\data\Model`, and are used to override the base-level default settings and dependencies. |
abstract public create ( mixed $query, array $options = [] ) : boolean | ||
$query | mixed | An object which defines the update operation(s) that should be performed against the data store. This can be a `Query`, a `RecordSet`, a `Record`, or a subclass of one of the three. Alternatively, `$query` can be an adapter-specific query string. |
$options | array | The options from Model include, - `validate` _boolean_ default: true - `events` _string_ default: create - `whitelist` _array_ default: null - `callbacks` _boolean_ default: true - `locked` _boolean_ default: true |
리턴 | boolean | Returns true if the operation was a success, otherwise false. |
abstract public describe ( mixed $entity, array $schema = [], array $meta = [] ) : array | ||
$entity | mixed | Specifies the table name for which the schema should be returned, or the class name of the model object requesting the schema, in which case the model class will be queried for the correct table name. |
$schema | array | |
$meta | array | The meta-information for the model class, which this method may use in introspecting the schema. |
리턴 | array | Returns a `Schema` object describing the given model's schema, where the array keys are the available fields, and the values are arrays describing each field, containing the following keys: - `'type'`: The field type name |
public isConnected ( array $options = [] ) : boolean | ||
$options | array | The options available for this method: - 'autoConnect': If true, and the connection is not currently active, calls `connect()` on this object. Defaults to `false`. |
리턴 | boolean | Returns the current value of `$_isConnected`, indicating whether or not the object's connection is currently active. This value may not always be accurate, as the connection could have timed out or otherwise been dropped by the remote resource during the course of the request. |
public relationFieldName ( $type, $name ) : string | ||
리턴 | string |
abstract public relationship ( $class, $type, $name, array $options = [] ) : array | ||
$class | the primary model of the relationship | |
$type | the type of the relationship (hasMany, hasOne, belongsTo) | |
$name | the name of the relationship | |
$options | array | relationship options |
리턴 | array | Returns an array containing the configuration for a model relationship. |
abstract public update ( mixed $query, array $options = [] ) : boolean | ||
$query | mixed | An object which defines the update operation(s) that should be performed against the data store. This can be a `Query`, a `RecordSet`, a `Record`, or a subclass of one of the three. Alternatively, `$query` can be an adapter-specific query string. |
$options | array | Options to execute, which are defined by the concrete implementation. |
리턴 | boolean | Returns true if the update operation was a success, otherwise false. |
protected array $_autoConfig | ||
리턴 | array |
protected array $_classes | ||
리턴 | array |
protected bool $_isConnected | ||
리턴 | boolean |
public mixed $connection | ||
리턴 | mixed |