ObjectSuggestions: Add methods to restrict $customVarSources

This commit is contained in:
Sukhwinder Dhillon 2024-11-26 14:25:48 +01:00 committed by Johannes Meyer
parent b52c219881
commit 481dac43f9

View file

@ -419,4 +419,18 @@ class ObjectSuggestions extends Suggestions
}
}
}
/**
* Reduce {@see $customVarSources} to only given relations to fetch variables from
*
* @param string[] $relations
*
* @return $this
*/
public function onlyWithCustomVarSources(array $relations): self
{
$this->customVarSources = array_intersect_key($this->customVarSources, array_flip($relations));
return $this;
}
}