Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

fetchAll params in DoctrineResource #17

Open
wimkumpen opened this issue Mar 25, 2014 · 0 comments
Open

fetchAll params in DoctrineResource #17

wimkumpen opened this issue Mar 25, 2014 · 0 comments

Comments

@wimkumpen
Copy link

You are not using the $params values that you pass into the method. You get the params form the event. Is this correct?

This limits my possibilities. I have my own ProductResource that extends DoctrineResource.
When I delete a product, I'm not really removing it, I just switch the flag 'deleted' in the database to 'true'.
From now, all fetchAll request have to exclude that product. So I thought of doing something like this:

class ProductResource extends Resource
{
  public function fetchAll($params = array()) {
        $params = array_merge_recursive($params->toArray(), array('query' => array(
            array(
                'field' => 'deleted',
                'value' => '0',
                'type'  => 'eq',
        ))));

        return parent::fetchAll($params);
  }
}

another example: user 1 is logged in and can only see his own orders. So, you must be able to add an extra 'user' parameters in your api...

I can always pass these params from the client... But seems so mutch overkill.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant