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

Refactor VolunteerProject API get to be less custom #516

Open
ginkgomzd opened this issue Jul 22, 2019 · 0 comments
Open

Refactor VolunteerProject API get to be less custom #516

ginkgomzd opened this issue Jul 22, 2019 · 0 comments
Labels

Comments

@ginkgomzd
Copy link
Contributor

There was a bug in VolunteerProject.getList preventing search-input from being supplied.
...Select lists allowed browsing the list of projects, but search input resulted in no results.

At first, it was determined our custom implentation of api_get was not supporting alternate WHERE comparison operators (other than '=').

This appeared an easy enough enhancement... but then it was revealed that WHERE IN was not getting properly generated SQL. "WHERE ( id IN 1,2,3 )" , i.e. the parens were not provided for the param list.

@eileenmcnaughton says:
ideally you would implement the public function addSelectWhereClause() in your BAO & then basic_get would do the perms

  /**

    Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity *
    Return format is in the form of fieldname => clauses starting with an operator. e.g.:
    @code
    array(
    'location_type_id' => array('IS NOT NULL', 'IN (1,2,3)')
    )
    @endcode *
    Note that all array keys must be actual field names in this entity. Use subqueries to filter on other tables e.g. custom values. *
    @return array */ public function addSelectWhereClause() { ```

more info:
https://github.com/civicrm/civicrm-dev-docs/issues/647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant