Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthoredward
     

    I'm trying to get pagination to work. I stumbled upon some bug? in Akelos? I get this error.

    Fatal error: Call to a member function on a non-object in /Users/xxxx/lib/AkActionController.php on line 2265
    

    when doing this in my controller:

    function custom()
    {
       $conditions = array('rooms' => '3');
       list($this->property_pages, $this->properties) = $this->paginate('properties', 
                                                                    array('per_page' => 3, 
                                                                        'conditions' => $conditions));
    }
    

    Looking inside AkActionController.php, I see this:

    /**
     * @todo Fix this function
     */
    function _paginationLoadPaginatorAndCollection($collection_id, $options)
    {
        $page = $this->params[$options['parameter']];
        $count = $this->_paginationCountCollection($klass, $options['conditions'],
        empty($options['join']) ? $options['join'] : $options['joins']);  <----- ERROR I suppose.
    
        require_once(AK_LIB_DIR.DS.'AkActionController'.DS.'AkPaginator.php');
        $paginator =& new AkPaginator($this, $count, $options['per_page'], $page);
        $collection =& $this->_paginationFindCollection($options['class_name'], $options, $paginator);
    
        return array(&$paginator, &$collection);
    }
    

    Shouldn't the code:

    empty($options['join']) ? $options['join'] : $options['joins']);
    

    be changed? It seems that we are forced to supply a joins value. Is that why I get the error?

    • CommentAuthorKaste
     

    Thats simply not implemented, I think. Maybe you can look into it.

    But from looking at the code.

    $count = $this->_paginationCountCollection($klass, $options['conditions'],
                                               ^^^^^^ <= ? not initialized
    

    so line 2265:

        return $model->count($conditions, $joins);
    

    must fail.