Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly better error messages for magic methods #163

Merged
merged 1 commit into from Nov 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions core/models/mvc_model.php
Expand Up @@ -798,18 +798,20 @@ public function __call($method, $args) {
if (isset($this->schema[$attribute])) {
$object = $this->find(array('conditions' => array($attribute => $args[0])));
return $object;
} else {
MvcError::fatal('Undefined attribute: '.$attribute.' for class: '.get_class($this).' when calling: '.$method.'.');
}
}
if (substr($method, 0, 12) == 'find_one_by_') {
$attribute = substr($method, 12);
if (isset($this->schema[$attribute])) {
$object = $this->find_one(array('conditions' => array($attribute => $args[0])));
return $object;
} else {
MvcError::fatal('Undefined attribute: '.$attribute.' for class: '.get_class($this).' when calling: '.$method.'.');
}
}
MvcError::fatal('Undefined method: '.get_class($this).'::'.$method.'.');
}

}

?>
16 changes: 14 additions & 2 deletions readme.txt
Expand Up @@ -2,8 +2,8 @@
Contributors: tombenner, robertpeake
Tags: mvc, framework, model, view, controller, development, plugin
Requires at least: 3.0
Tested up to: 4.4
Stable tag: 1.3.6
Tested up to: 4.6.1
Stable tag: 1.3.7

WP MVC is a full-fledged MVC framework, similar to CakePHP and Rails, that developers can use inside of WordPress.

Expand Down Expand Up @@ -71,6 +71,18 @@ If there's functionality that you'd like to use that isn't implemented in the ex

== Changelog ==

= 1.3.7 =
* Better model validation in admin
* Modernisation of classes (public/private, constructor)
* New input type:
* File input type with enctype attribute
* Editor field input type
* Select from model input type
* Form submit button suppression
* Optional admin table actions
* Support for TRUE, FALSE and NULL comparitors in queries
* Use of umeta_id in user meta model

= 1.3.6 =

* Added required attribute for settings field
Expand Down
2 changes: 1 addition & 1 deletion wp_mvc.php
Expand Up @@ -4,7 +4,7 @@
Plugin URI: http://wordpress.org/extend/plugins/wp-mvc/
Description: Sets up an MVC framework inside of WordPress.
Author: Tom Benner
Version: 1.3.6
Version: 1.3.7
Author URI: https://github.com/tombenner
*/

Expand Down