function testgetNextLevelYear()
 {
     $entity = new VF_Level('year');
     $this->assertEquals( '', $entity->getNextLevel(), 'getNextLevel should return emtpy string if called on a leaf level' );
 }
 protected function doGetChildCount( VF_Level $entity )
 {    
     if( $entity->getNextLevel() == '' )
     {
         return 0;
     }
     
     $q = $this->getReadAdapter()->select()
         ->from(array('l'=>$this->getSchema()->levelTable($entity->getNextLevel())), 'count(distinct(l.id))')
         ->joinLeft(array('d'=>$this->getSchema()->definitionTable()), 'l.id = d.' . $entity->getNextLevel() . '_id', array())
         ->where('d.' . $entity->getType() . '_id = ?', $entity->getId() )
         ->where('d.' . $entity->getNextLevel() . '_id != 0' );
                           
     $r = $this->query( $q );
     return (int)$r->fetchColumn();
 }