Overview

Abstract class to represent the characteristics of a related model.

Package

This class is part of the Solar_Sql_Model package.

Inheritance:

Configuration Keys

  • wherein_max: The default value for the 'wherein_max' setting.

Constants

None.

Public Properties

These are all the public properties in the Solar_Sql_Model_Related class.

You can also view the list of all public, protected, and private properties.

$cols

Fetch these columns for the related records.

$conditions

Additional conditions when fetching related records.

$foreign_alias

Aliases the foreign table to this name.

$foreign_class

The class name of the foreign model.

$foreign_col

The name of the column to join with in the foreign table.

$foreign_key

The virtual element called foreign_key automatically populates the native_col or foreign_col value for you, based on the association type.

$foreign_name

The virtual element called foreign_name automatically sets the foreign_class by looking up the foreign_name in the model catalog.

$foreign_primary_col

The name of the foreign primary column.

$foreign_table

The name of the table for the foreign model.

$merge

Indicates the strategy to use for merging joined rows; 'server' means the database will do it via a single SELECT combined into the native fetch, whereas 'client' means PHP will do it, using one additional SELECT for the relationship.

$name

The name of the relationship as defined by the original (native) model.

$native_alias

The alias for the native table.

$native_by

What strategy should be used for connecting to native records when eager-fetching: 'wherein', meaning a "WHERE IN (...)" a list of native IDs, or 'select', meaning a join against a sub-SELECT.

$native_class

The class of the native model.

$native_col

The native column to match against the foreign primary column.

$order

Additional ORDER clauses when fetching related records.

$type

The type of the relationship as defined by the original (native) model; e.g., 'has_one', 'belongs_to', 'has_many'.

$wherein_max

When picking a native-by strategy, use 'wherein' for up to this many record in the native result; after this point, use a 'select' strategy.

Public Methods

These are all the public methods in the Solar_Sql_Model_Related class.

You can also view the list of all public, protected, and private methods.

__construct()

Constructor.

__destruct()

Default destructor; does nothing other than provide a safe fallback for calls to parent::__destruct().

dump()

Convenience method for getting a dump the whole object, or one of its properties, or an external variable.

fetch()

Fetches the related record or collection for a native ID or record.

fetchEmpty()

Returns a new empty value appropriate for a lazy- or eager-fetch; this is different for each kind of related.

fetchNew()

Fetches a new record or collection object.

getForeignConditions()

Gets the foreign-model WHERE conditions and merges with the WHERE conditions on this relationship.

getModel()

Returns the related (foreign) model instance.

isInvalid()

Is the related record or collection valid?

isMany()

Is this related to many records?

isOne()

Is this related to one record?

load()

Loads this relationship object with user-defined characteristics (options), and corrects them as needed.

locale()

Looks up class-specific locale strings based on a key.

modEagerFetch()

Fixes the native fetch params and eager params; then, if the join_flag is set on the eager, calles _modEagerFetch() to modify the native fetch params based on the eager params.

modEagerResult()

Modifies the parent result array to add eager records.

newObject()

Packages foreign data as a record or collection object.

preSave()

Pre-save hook for saving related records or collections from a native record.

save()

Saves a related record or collection from a native record.

setNativeModel()

Sets the native (origin) model instance.

toArray()

Returns the relation characteristics as an array.



Local