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
Support filter parameters in Configuration #1077
base: old-prototype-3.x
Are you sure you want to change the base?
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3200 We use Jira to track the state of pull requests and the versions they got |
lib/Doctrine/ORM/Configuration.php
Outdated
{ | ||
$this->_attributes['filters'][$name] = $className; | ||
$this->_attributes['filters'][$name] = array( | ||
'className' => $className, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just use class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur. Will make the change in ODM as well.
@jmikola what about adding possibility to disable/attaching filter per query? |
@Koc you can already enable or disable filters by using the FilterCollection. the goal of this PR is to preset some filter parameters in the config |
Of course this PR has other goal. Just if Jeremy starts working on improvements of filters maybe he can add some changes. By the way, code like $em->getFilters()->disable('ololo_filter');
// my query
$em->getFilters()->enable('ololo_filter'); looks ugly for me. And sometimes it non-acceptable. When you building dynamic query in several application layers, for example. |
i dont think we have filters at all in PHPCR ODM /cc @dbu |
no, we do not have filters in the SQL2 part of phpcr-odm. sounds like a potentially interesting feature eventually. |
*/ | ||
public function addFilter($name, $className) | ||
public function addFilter($name, $className, array $parameters = array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the correct solution here would be to pass in a new instance of a filter, which also removes this auto-instantiation thing, but there's also the fact that filters should not be THAT flexible. Ping @asm89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ocramius: I don't see how we could do that without breaking BC, though. Unless $className
was changed to conditionally accept an object (in which FilterCollection only needs getFilterClassName()
for times when an object wasn't provided).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need @asm89 to look at it to know why this was designed this way in first place
@asm89 ping? |
Sorry folks, i know this is not proper place for my issue but ...
will throw
for enabled by default filter it is ok
should i make PR with specific tests for this case or what? Thanks! |
Sorry, any progress on this ? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Please use https://github.com/doctrine/orm/discussions for support questions. |
Based on work done in doctrine/mongodb-odm#908
My understanding is that this makes it easier to setup filters at boot time, instead of having to fetch them from the collection later on.
For added context, the related PR from MongoDB ODM's Symfony bundle is doctrine/DoctrineMongoDBBundle#255