Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
100 lines (90 loc) · 3.22 KB

File metadata and controls

100 lines (90 loc) · 3.22 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
/**
* Author: imsamurai <im.samuray@gmail.com>
* Date: 04.12.2012
* Time: 17:08:18
* Format: http://book.cakephp.org/2.0/en/models.html
*/
App::uses('AppModel', 'Model');
/**
* Model with patched methods to wirk with save()
*/
abstract class HttpSourceModel extends AppModel {
/**
* Model name
*
* @var string
*/
public $name = 'HttpSource';
/**
* Sets credentials data
*
* @param array $credentials
*/
public function setCredentials(array $credentials = array()) {
$this->getDataSource()->setCredentials($credentials);
}
/**
* Returns true if the supplied field exists in the model's database table.
*
* @param string|array $name Name of field to look for, or an array of names
* @param boolean $checkVirtual checks if the field is declared as virtual
* @return mixed If $name is a string, returns a boolean indicating whether the field exists.
* If $name is an array of field names, returns the first field that exists,
* or false if none exist.
*/
public function hasField($name, $checkVirtual = false) {
return true;
}
/**
* Returns true if a record with particular ID exists.
*
* If $id is not passed it calls Model::getID() to obtain the current record ID,
* and then performs a Model::find('count') on the currently configured datasource
* to ascertain the existence of the record in persistent storage.
*
* @param integer|string $id ID of record to check for existence
* @return boolean True if such a record exists
*/
public function exists($id = null) {
return true;
}
/**
* Wrapper for save() to use update method datasource
*
* @param array $data Data to save.
* @param boolean|array $validate Either a boolean, or an array.
* If a boolean, indicates whether or not to validate before saving.
* If an array, allows control of validate, callbacks, and fieldList
* @param array $fieldList List of fields to allow to be written
* @return mixed On success Model::$data if its not empty or true, false on failure
* @link http://book.cakephp.org/2.0/en/models/saving-your-data.html
*/
public function update($data = null, $validate = true, $fieldList = array()) {
$this->id = true;
return $this->save($data, $validate, $fieldList);
}
/**
* Removes record for given ID. If no ID is given, the current ID is used. Returns true on success.
*
* @param integer|string $id ID of record to delete
* @param boolean $cascade Set to true to delete records that depend on this record (NOT USED)
* @return boolean True on success
* @link http://book.cakephp.org/2.0/en/models/deleting-data.html
*/
public function delete($id = null, $cascade = true) {
return parent::delete($id, false);
}
/**
* Deletes multiple model records based on a set of conditions.
*
* @param mixed $conditions Conditions to match
* @param boolean $cascade Set to true to delete records that depend on this record (NOT USED)
* @param boolean $callbacks Run callbacks (NOT USED)
* @return boolean True on success, false on failure
* @link http://book.cakephp.org/2.0/en/models/deleting-data.html#deleteall
*/
public function deleteAll($conditions, $cascade = true, $callbacks = false) {
return parent::deleteAll($conditions, false, false);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.