Relation: HasMany
public hasMany ( EntityInterface $entity, $entityName, $foreignKey, $localValue = null ) | ||
$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')]; }