public function hasManyThrough(EntityInterface $entity, $hasManyEntity, $throughEntity, $selectField, $whereField)
{
$localPkField = $this->primaryKeyField();
$localValue = $entity->{$localPkField};
if (!is_subclass_of($hasManyEntity, 'Spot\\EntityInterface')) {
throw new \InvalidArgumentException("Related entity name must be a " . "valid entity that extends Spot\\Entity. Given '" . $hasManyEntity . "'.");
}
if (!is_subclass_of($throughEntity, 'Spot\\EntityInterface')) {
throw new \InvalidArgumentException("Related entity name must be a " . "valid entity that extends Spot\\Entity. Given '" . $throughEntity . "'.");
}
return new Relation\HasManyThrough($this, $hasManyEntity, $throughEntity, $selectField, $whereField, $localValue);
}