protected function addByUser(array $data)
    {
        $result = null;
        $this->hook->attach('rating.add.user.before', $data, $result, $this);

        if (isset($result)) {
            return (int) $result;
        }

        if (empty($data['rating'])) {
            return 0; // Do not add rating 0 (unvote)
        }

        $result = $this->db->insert('rating_user', $data);
        $this->hook->attach('rating.add.user.after', $data, $result, $this);
        return (int) $result;
    }
protected function addByUser(array $data)
    {
        $result = null;
        $this->hook->attach('rating.add.user.before', $data, $result, $this);

        if (isset($result)) {
            return (int) $result;
        }

        if (empty($data['rating'])) {
            return 0; // Do not add rating 0 (unvote)
        }

        $result = $this->db->insert('rating_user', $data);
        $this->hook->attach('rating.add.user.after', $data, $result, $this);
        return (int) $result;
    }
protected function addByUser ( array $ data ) { $ result = null ; $ this -> hook -> attach ( 'rating.add.user.before' , $ data , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( int ) $ result ; } if ( empty ( $ data [ 'rating' ] ) ) { return 0 ; // Do not add rating 0 (unvote) } $ result = $ this -> db -> insert ( 'rating_user' , $ data ) ; $ this -> hook -> attach ( 'rating.add.user.after' , $ data , $ result , $ this ) ; return ( int ) $ result ; }
Adds a user rating
@param array $data
@return integer
Adds a user rating