Skip to content

Instantly share code, notes, and snippets.

@evgeniy1204
Created March 27, 2018 08:59
Show Gist options
  • Save evgeniy1204/d4fb5752e58496f3f8d2d77bc9d07fa8 to your computer and use it in GitHub Desktop.
Save evgeniy1204/d4fb5752e58496f3f8d2d77bc9d07fa8 to your computer and use it in GitHub Desktop.
<?php
->add('ride', 'filter_collection_adapter', array(
'type' => new BookingOptionalRideToFilterType(),
'label' => 'Corsa',
'add_shared' => function (FilterBuilderExecuterInterface $qbe) {
$closure = function (QueryBuilder $filterBuilder, $alias, $joinAlias, Expr $expr) {
$filterBuilder->leftJoin('AppBundle:RideSelector', 'rideSelector', 'WITH', 'rideSelector.object_class = \'AppBundle\Entity\BookingOptional\'');
$filterBuilder->leftJoin('AppBundle:Ride', 'ride', 'WITH', 'ride.id IN (rideSelector.ride_tags)');
};
// then use the query builder executor to define the join, the join's alias and things to do on the doctrine query builder.
$qbe->addOnce($qbe->getAlias().'.ride', 'ride', $closure);
},
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment