1: <?php
2: /**
3: * Demo product service.
4: *
5: * <p>Here you can add a short overview or tutorial of how provided methods can be utilized
6: * by the consumer.</p>
7: *
8: * You can even use <b>HTML markup</b>, at least whatever <a href="http://apigen.org/">apigen</a>
9: * accepts.
10: *
11: * @package RestApi.Services
12: * @author Konstantinos Filios <konfilios@gmail.com>
13: */
14: class ProductController extends CBJsonController
15: {
16: /**
17: * Find products.
18: *
19: * @param ProductQueryJson $queryJson Query criteria
20: * @return ProductJson[] Matching products
21: */
22: public function actionFindProduct(ProductQueryJson $queryJson)
23: {
24: $foundProducts = Product::model()->scopeApplyQuery($queryJson)->findAll();
25:
26: return ProductJson::createFromMany($foundProducts);
27: }
28: }
29:
30: