Have a problem.
There is my route method:
book_list:
url: /api/books.:sf_format
class: sfDoctrineRoute
options: { model: Book, type: list, method: getActiveWithAuthor }
param: { module: book, action: list, sf_format: json }
requirements:
sf_format: (?:json|html)
code in action is simple:
public function executeList(sfWebRequest $request) {
$this->books = $this->getRoute()->getObjects();
}
And custom method for getting the Books
public function getActiveWithAuthor(array $parameters) {
// crit is easy to find in logs.
sfContext::getInstance()->getLogger()->crit(var_export($parameters, true));
return BookQuery::create()
->addSelf()
->addAuthor()
->execute();
}
The problem is, that I would like to filter books by optional parammeter “date_from”, which could be in url, e.g. /api/books?date_from=2011-02-18
But in log I could see only “sf_format => html” (or json)
What should I use for getting the optional parrameter “date_from”?
1 Answer