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

CountOf or having usage? #126

Closed
PavelJurasek opened this issue Feb 10, 2016 · 2 comments
Closed

CountOf or having usage? #126

PavelJurasek opened this issue Feb 10, 2016 · 2 comments

Comments

@PavelJurasek
Copy link

Hi,

I'm wondering if it is possible to use these functions to filter out entities that do not have any related records, e.g.: Select all galleries that have at least 1 photo added to it.

I expected something like Spec::gt(Spec::countOf('photos'), 0) would work but it doesn't. I also unsuccessfully tried Spec::gt('COUNT(photos)', 0).

Thanks!

@Nyholm
Copy link
Member

Nyholm commented Feb 26, 2016

Interesting use case. As you discovered, that is not supported atm. But I believe that feature should be on the wish list.

@peter-gribanov
Copy link
Member

Now you can using functions in specification:

$spec = Spec::gt(Spec::COUNT('photos'), 0);

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

3 participants