CollectionInterface.php
3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
namespace Phalcon\Mvc {
/**
* Phalcon\Mvc\CollectionInterface initializer
*/
interface CollectionInterface {
/**
* \Phalcon\Mvc\Collection
*
* @param \Phalcon\DiInterface $dependencyInjector
*/
public function __construct($dependencyInjector=null);
/**
* Sets a value for the _id propery, creates a MongoId object if needed
*
* @param mixed $id
*/
public function setId($id);
/**
* Returns the value of the _id property
*
* @return MongoId
*/
public function getId();
/**
* Returns an array with reserved properties that cannot be part of the insert/update
*
* @return array
*/
public function getReservedAttributes();
/**
* Returns collection name mapped in the model
*
* @return string
*/
public function getSource();
/**
* Sets a service in the services container that returns the Mongo database
*
* @param string $connectionService
*/
public function setConnectionService($connectionService);
/**
* Retrieves a database connection
*
* @return MongoDb
*/
public function getConnection();
/**
* Reads an attribute value by its name
*
* @param string $attribute
* @return mixed
*/
public function readAttribute($attribute);
/**
* Writes an attribute value by its name
*
* @param string $attribute
* @param mixed $value
*/
public function writeAttribute($attribute, $value);
/**
* Returns a cloned collection
*
* @param \Phalcon\Mvc\Collection $collection
* @param array $document
* @return \Phalcon\Mvc\Collection
*/
public static function cloneResult($collection, $document);
/**
* Fires an event, implicitly calls behaviors and listeners in the events manager are notified
*
* @param string $eventName
* @return boolean
*/
public function fireEvent($eventName);
/**
* Fires an event, implicitly listeners in the events manager are notified
* This method stops if one of the callbacks/listeners returns boolean false
*
* @param string $eventName
* @return boolean
*/
public function fireEventCancel($eventName);
/**
* Check whether validation process has generated any messages
*
* @return boolean
*/
public function validationHasFailed();
/**
* Returns all the validation messages
*
* @return \Phalcon\Mvc\Model\MessageInterface[]
*/
public function getMessages();
/**
* Appends a customized message on the validation process
*
* @param \Phalcon\Mvc\Model\MessageInterface $message
*/
public function appendMessage($message);
/**
* Creates/Updates a collection based on the values in the atributes
*
* @return boolean
*/
public function save();
/**
* Find a document by its id
*
* @param string $id
* @return \Phalcon\Mvc\Collection
*/
public static function findById($id);
/**
* Allows to query the first record that match the specified conditions
*
* @param array $parameters
* @return array
*/
public static function findFirst($parameters=null);
/**
* Allows to query a set of records that match the specified conditions
*
* @param array $parameters
* @return array
*/
public static function find($parameters=null);
/**
* Perform a count over a collection
*
* @param array $parameters
* @return array
*/
public static function count($parameters=null);
/**
* Deletes a model instance. Returning true on success or false otherwise
*
* @return boolean
*/
public function delete();
}
}