<?php defined('SYSPATH') or die('No direct access allowed.'); class Model_Image_Comment extends ORM { protected $_belongs_to = array('user' => array()); static public function getCount( $image_id ) { $comment = ORM::Factory('image_comment')->where('image_id','=',$image_id)->find_all(); return $comment->count(); } }