PHP Class FOF30\Model\DataModel\Relation\HasMany

For example, parentModel is Users and foreignModel is Articles. Each user has zero or more articles.
Inheritance: extends FOF30\Model\DataModel\Relation
Afficher le fichier Open project: akeeba/fof Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( DataModel $parentModel, string $foreignModelName, string $localKey = null, string $foreignKey = null, string $pivotTable = null, string $pivotLocalKey = null, string $pivotForeignKey = null ) Public constructor. Initialises the relation.
getCountSubquery ( string $tableAlias = null ) : JDatabaseQuery Returns the count subquery for DataModel's has() and whereHas() methods.
getNew ( ) : DataModel Returns a new item of the foreignModel type, pre-initialised to fulfil this relation

Méthodes protégées

Méthode Description
filterForeignModel ( DataModel $foreignModel, Collection $dataCollection = null ) : boolean Applies the relation filters to the foreign model when getData is called

Method Details

__construct() public méthode

Public constructor. Initialises the relation.
public __construct ( DataModel $parentModel, string $foreignModelName, string $localKey = null, string $foreignKey = null, string $pivotTable = null, string $pivotLocalKey = null, string $pivotForeignKey = null )
$parentModel FOF30\Model\DataModel The data model we are attached to
$foreignModelName string The name of the foreign key's model in the format "modelName@com_something"
$localKey string The local table key for this relation, default: parentModel's ID field name
$foreignKey string The foreign key for this relation, default: parentModel's ID field name
$pivotTable string IGNORED
$pivotLocalKey string IGNORED
$pivotForeignKey string IGNORED

filterForeignModel() protected méthode

Applies the relation filters to the foreign model when getData is called
protected filterForeignModel ( DataModel $foreignModel, Collection $dataCollection = null ) : boolean
$foreignModel FOF30\Model\DataModel The foreign model you're operating on
$dataCollection FOF30\Model\DataModel\Collection If it's an eager loaded relation, the collection of loaded parent records
Résultat boolean Return false to force an empty data collection

getCountSubquery() public méthode

Returns the count subquery for DataModel's has() and whereHas() methods.
public getCountSubquery ( string $tableAlias = null ) : JDatabaseQuery
$tableAlias string The alias of the local table in the query. Leave blank to use the table's name.
Résultat JDatabaseQuery

getNew() public méthode

Returns a new item of the foreignModel type, pre-initialised to fulfil this relation
public getNew ( ) : DataModel
Résultat FOF30\Model\DataModel