Relation: HasManyThrough
public hasManyThrough ( EntityInterface $entity, $hasManyEntity, $throughEntity, $selectField, $whereField ) | ||
$entity | EntityInterface |
public static function relations(Mapper $mapper, Entity $entity) { return ['tags' => $mapper->hasManyThrough($entity, 'SpotTest\\Entity\\Tag', 'SpotTest\\Entity\\PostTag', 'tag_id', 'post_id'), 'comments' => $mapper->hasMany($entity, 'SpotTest\\Entity\\Post\\Comment', 'post_id')->order(['date_created' => 'ASC']), 'author' => $mapper->belongsTo($entity, 'SpotTest\\Entity\\Author', 'author_id')]; }
public static function relations(Mapper $mapper, Entity $entity) { return ['posts' => $mapper->hasManyThrough($entity, 'SpotTest\\Entity\\Post', 'SpotTest\\Entity\\PostTag', 'tag_id', 'post_id')]; }