Kohana 3: Validation rule for has_many through relationship -


is possible create validation rule in kohana 3 validate has_many through relationship?

using example on guide page, blog post can have many categories through categories_posts table. there validation rule can setup in post model verify @ least 1 category added?

i tried following:

public function rules() {     return array(         'categories' => array(             array(array($this, 'has'), array('categories'))         )     ); } 

because see orm::has function return true/false. think because 'categories' relationship, , not field, rule wrote never gets checked.

any ideas?

you must save post before adding has_many relations. can check post categories after saving, , mark draft if not set.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -