summaryrefslogtreecommitdiff
path: root/idiorm.php
diff options
context:
space:
mode:
authormichaelward82 <[email protected]>2013-09-14 14:35:54 +0100
committerSimon Holywell <[email protected]>2013-12-26 16:18:40 +0000
commit3530b21fec1ee958a2c0d9c31ed83d53ac66ceee (patch)
tree7bc531024813e92e7529bf025e5a6e7d652d5a1b /idiorm.php
parent909c6da9d5a8fcff09d6f5655eeb677cde5acfb6 (diff)
Adds new IdiormMethodMissingException class for missing magic method calls to ORM and IdiormResultSet
Diffstat (limited to 'idiorm.php')
-rw-r--r--idiorm.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/idiorm.php b/idiorm.php
index 32dddee..f1ce00c 100644
--- a/idiorm.php
+++ b/idiorm.php
@@ -1886,7 +1886,11 @@
{
$method = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $name));
- return call_user_func_array(array($this, $method), $arguments);
+ if (method_exists($this, $method)) {
+ return call_user_func_array(array($this, $method), $arguments);
+ } else {
+ throw new IdiormMethodMissingException("Method $name() does not exist in class " . get_class($this));
+ }
}
/**
@@ -2136,7 +2140,11 @@
*/
public function __call($method, $params = array()) {
foreach($this->_results as $model) {
- call_user_func_array(array($model, $method), $params);
+ if (method_exists($model, $method)) {
+ call_user_func_array(array($model, $method), $params);
+ } else {
+ throw new IdiormMethodMissingException("Method $method() does not exist in class " . get_class($this));
+ }
}
return $this;
}
@@ -2146,3 +2154,5 @@
* A placeholder for exceptions eminating from the IdiormString class
*/
class IdiormStringException extends Exception {}
+
+ class IdiormMethodMissingException extends Exception {} \ No newline at end of file