Skip to content

Instantly share code, notes, and snippets.

@rafi
Created November 21, 2011 15:00
Show Gist options
  • Save rafi/1382870 to your computer and use it in GitHub Desktop.
Save rafi/1382870 to your computer and use it in GitHub Desktop.
validation: model related with other models
class Model_Core_Account extends Abstract_Model_Base {
public $list_fields = array();
public function check()
{
// validate list fields if exist, here!
// call parent model validation
return parent::check();
}
class Controller_API_Accounts extends Controller_API {
public function post_collection()
{
$account = new ...
$account->list_fields = arr::get($this->_request_body, 'fields', array());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment