Created
April 10, 2013 15:52
-
-
Save dwaligora/5355864 to your computer and use it in GitHub Desktop.
doctrine filter so ***** simple test with sf2.1
This file contains 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 | |
namespace Acme\Bundle\Doctrine\Filter; | |
use Doctrine\ORM\Mapping\ClassMetaData, | |
Doctrine\ORM\Query\Filter\SQLFilter, | |
Doctrine\ORM\EntityManager, | |
Doctrine\DBAL\Types\Type as DBALType; | |
/** | |
* Description of TestFilter | |
* | |
* @author danielwaligora | |
*/ | |
class TestFilter extends SQLFilter | |
{ | |
public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) | |
{ | |
if($targetEntity->name === 'Acme\Bundle\Entity\Clip') { | |
return $targetTableAlias.'.duration > 1'; | |
} | |
return ''; //this is MANDATORY! | |
} | |
} | |
?> |
This file contains 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
orm: | |
auto_generate_proxy_classes: %kernel.debug% | |
default_entity_manager: default | |
entity_managers: | |
default: | |
auto_mapping: true | |
filters: | |
test: | |
class: Acme\Bundle\Doctrine\Filter\TestFilter | |
enabled: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment