lucee.Componentquick.models.Relationships.BaseRelationship
quick.models.Relationships.HasOneOrMany
quick.models.Relationships.HasMany
Represents a hasMany relationship. This is a relationship where the parent entity has zero or more of the related entity. The inverse of this relationship is a `belongsTo` relationship. For instance, a `User` may have zero or more `Post` associated to them. This would be modeled in Quick by adding a method to the `User` entity that returns a `HasMany` relationship instance. ``` function posts() { returns hasMany( "Post" ); } ```
Method Summary | |
---|---|
array<BaseEntity>
|
getResults()
Returns the result of the relationship. |
array<BaseEntity>
|
initRelation(array entities, string relation)
Initializes the relation to the null value for each entity in an array. |
array<BaseEntity>
|
match(array entities, array results, string relation)
Matches the array of entity results to an array of entities for a relation. |
Methods inherited from class lucee.Component |
---|
None |
Method Detail |
---|
Returns the result of the relationship.
Initializes the relation to the null value for each entity in an array.
entities
- The entities to initialize the relation.relation
- The name of the relation to initialize.Matches the array of entity results to an array of entities for a relation. Any matched records are populated into the matched entity's relation.
entities
- The entities being eager loaded.results
- The relationship results.relation
- The relation name being loaded.