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
Post a Comment