Cakephp3休息参数/过滤器
I use CakePHP 3 and try to create a REST access.
When connecting to homepage.tld/invoices.json I get all invoices (which is correct).
But now I'd like to use parameter/filter to reduce the output and fetch specific invoices:
homepage.tld/invoices.json?id=5 <-- only the invoice with id 5
homepage.tld/invoices.json?customer_id=3 <-- all invoices with a customer_id=3
Is there a simple solution or is manual programming required?
我使用CakePHP 3并尝试创建REST访问。 p>
连接到homepage.tld / invoices.json我得到所有发票(这是正确的)。 p>
但是现在我想使用参数/过滤器来减少输出并获取特定的发票: p>
homepage.tld / invoices.json?id = 5&lt; - 仅发票号为5 p>
主页的发票。 tld / invoices.json?customer_id = 3&lt; - 所有发票都是 customer_id = 3 p> blockquote>
是否有简单的解决方案或需要手动编程? p> div>
Is there a simple solution or is manual programming required?
Yes, you need to write code for that.
But you can use the friends of cake search plugin for that, it will make it easy and less repetitive.