find($options)
13: function find($options) {
14: $options = $this->_render_options($options);
15: return $this->_select($options);
16: }
File: lib/model/ActiveRecord.php, #line 13
find_by_sql($sql)
21: function find_by_sql($sql) {
22: $options['sql'] = $sql;
23: return $this->_select($options);
24: }
File: lib/model/ActiveRecord.php, #line 21
save()
29: function save() {
30: Callbacks :: callback('before_validate');
31: Callbacks :: callback('validate_on_save');
32: $validation = new Validation(& $this);
33: Callbacks :: callback('after_validate');
34:
35: $this->field_error = array_merge($this->field_error, $validation->get_errors());
36: if ($this->field_error) {
37: return false;
38: } else {
39: Callbacks :: callback('before_save');
40: if (isset ($this->id)) {
41: if ($this->_update_model(& $this)) {
42: Callbacks :: callback('after_save');
43: return $this;
44: } else {
45: return false;
46: }
47: } else {
48: if ($this->_save_model(& $this)) {
49: Callbacks :: callback('after_save');
50: return $this;
51: } else {
52: return false;
53: }
54: }
55: }
56: }
File: lib/model/ActiveRecord.php, #line 29
update($attributes = array ())
61: function update($attributes = array ()) {
62: if ($attributes) {
63: foreach ($attributes as $key => $value) {
64: $this-> $key = $value;
65: }
66: }
67:
68: Callbacks :: callback('before_validate');
69: Callbacks :: callback('validate_on_update');
70: $validation = new Validation(& $this);
71: Callbacks :: callback('after_validate');
72: $this->field_error = array_merge($this->field_error, $validation->get_errors());
73:
74: if ($this->field_error) {
75: return false;
76: } else {
77: Callbacks :: callback('before_update');
78: if ($this->_update_model(& $this)) {
79: Callbacks :: callback('after_update');
80: return $this;
81: } else {
82: return false;
83: }
84: }
85: }
File: lib/model/ActiveRecord.php, #line 61
update_attributes($params)
90: function update_attributes($params) {
91: foreach ($params as $key => $value) {
92: $this-> $key = $value;
93: }
94:
95: Callbacks :: callback('before_validate');
96: Callbacks :: callback('validate_on_update');
97: $validation = new Validation(& $this);
98: Callbacks :: callback('after_validate');
99:
100: $this->field_error = array_merge($this->field_error, $validation->get_errors());
101:
102: if ($this->field_error) {
103: return false;
104: } else {
105: Callbacks :: callback('before_update');
106: if ($this->_update_model_attributes($params)) {
107: Callbacks :: callback('after_update');
108: return true;
109: } else {
110: return false;
111: }
112: }
113: }
File: lib/model/ActiveRecord.php, #line 90
update_all($attributes = array (), $options = array ())
118: function update_all($attributes = array (), $options = array ()) {
119: Callbacks :: callback('before_upate');
120: if ($this->_update_all($attributes, $options)) {
121: Callbacks :: callback('after_update');
122: return true;
123: } else {
124: return false;
125: }
126: }
File: lib/model/ActiveRecord.php, #line 118
create($params = ”)
131: function create($params = '') {
132: $class = get_class($this);
133: if (is_array($params)) {
134: $obj = new $class;
135: $obj->params = &$this->params;
136: foreach ($params as $key => $param) {
137: $obj-> $key = $param;
138: }
139: return $obj;
140: } else {
141: $obj = new $class;
142: $obj->params = &$this->params;
143: return $obj;
144: }
145: }
File: lib/model/ActiveRecord.php, #line 131
destroy()
150: function destroy() {
151: Callbacks :: callback('before_destroy');
152: if ($this->destroy_model()) {
153: Callbacks :: callback('after_destroy');
154: $this->destroy_has_and_belongs_to_many();
155: $this->destroy_polymorphic();
156: return true;
157: } else {
158: return false;
159: }
160: }
File: lib/model/ActiveRecord.php, #line 150
valid($method = ”)
165: function valid($method = '') {
166: if ($method) {
167: if (method_exists($this, $method)) {
168: call_user_func(array (
169: $this,
170: $method
171: ));
172: }
173: }
174: $validation = new Validation(& $this);
175: $this->field_error = array_merge($this->field_error, $validation->get_errors());
176: if ($this->field_error) {
177: return false;
178: } else {
179: return true;
180: }
181: }
File: lib/model/ActiveRecord.php, #line 165
