Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstanceOfX not taking context into account #321

Open
cyrnetix opened this issue Oct 17, 2024 · 0 comments
Open

InstanceOfX not taking context into account #321

cyrnetix opened this issue Oct 17, 2024 · 0 comments

Comments

@cyrnetix
Copy link

I was just trying to apply filtering on a collection with InstanceOfX but it failed while the DQL version works fine. I figured out that the isStatisfiedBy() method does not take context into account in any way but the DQL does.

Would this be a proper fix?

public function isSatisfiedBy($candidate, ?string $context = null): bool
{
	if (null !== $this->context) {
		$candidate = ArgumentToOperandConverter::toField($this->context)
			->execute($candidate, $context);
	}

        return $candidate instanceof $this->value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant