Last active
August 29, 2015 13:57
-
-
Save bdunogier/9627191 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// "Simple" query (e.g. no logical operations) | |
// is_class( article, blog_post ) AND parent_location_id( 4 ) AND attr_enabled = true AND attr_publishing_date = <DATE> | |
$queryBuilder | |
->contentTypeIdentifier()->in( 'article', 'blog_post' ) | |
->parentLocationId()->eq( 2 ) | |
->checkboxField( 'enabled' )->isFalse() | |
->dateField( 'publishing_date' )->before( 'last monday' ) | |
->sortBy() | |
->datePublished()->descending() | |
->contentName()->ascending(); | |
// "Complex" query (e.g. with logical operations) | |
// ( ( is_class( article, blog ) AND parent_location_id( 2 ) ) OR attr_can_syndicate == true ) AND published > 10 days | |
$queryBuilder | |
->or( | |
$queryBuilder->expr()->and( | |
$queryBuilder->expr() | |
->contentTypeIdentifier()->in( 'article', 'blog' ) | |
->parentLocationId()->eq( 2 ) | |
) | |
->checkboxField( 'can_syndicate' )->isTrue() | |
) | |
->wasCreated()->before( '10 days ago' ) | |
->sortBy()->datePublished()->ascending(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment