source: sandbox/2.4.1-3/prototype/rest/hypermedia/collection.php @ 6429

Revision 6429, 1.4 KB checked in by gustavo, 12 years ago (diff)

Ticket #2766 - Correções na arquitetura REST(campo DATA) e arrumado os recursos

  • Property svn:executable set to *
Line 
1<?php
2
3include_once('item.php');
4include_once('link.php');
5include_once('data.php');
6include_once('template.php');
7include_once('query.php');
8include_once('error.php');
9
10class Collection {
11
12    public $itens = array();
13    public $href;
14    public $error;
15    public $pagination;
16    public $queries = array();
17    public $template;
18    public $type;
19    public $data = array();
20
21    function __construct($config, $className) {
22        foreach ($config as $key => $value) {
23            if ($value['class'] == $className) {
24                $uri = $key;
25                break;
26            }
27        }
28        $this->href = $uri;
29    }
30
31    function addItem($item) {
32        $this->itens[] = $item;
33    }
34       
35        function addData($data) {
36        $this->data[] = $data;
37    }
38
39    function getData() {
40        return $this->data;
41    }
42   
43    function setTemplate($template) {
44        $this->template = $template;
45    }
46
47    function getTemplate() {
48        return $this->template;
49    }
50
51    function setType($type) {
52        $this->type = $type;
53    }
54
55    function getType() {
56        return $this->type;
57    }
58
59    function addQueries($queries) {
60        $this->queries[] = $queries;
61    }
62
63    function getQueries() {
64        return $this->queries;
65    }
66
67    function setError($error) {
68        $this->error = $error;
69    }
70
71    function getError() {
72        return $this->error;
73    }
74
75    function setPagination($pagination) {
76        $this->pagination = $pagination;
77    }
78
79    function getPagination() {
80        return $this->pagination;
81    }
82
83}
84
85?>
Note: See TracBrowser for help on using the repository browser.