nikrou / eventHandler

a dotclear plugin to manage events in your blog.
Other
2 stars 5 forks source link

eventHandler->getEvents won't allow $params['sql_only'] usage #41

Closed onurb-taktile closed 5 years ago

onurb-taktile commented 5 years ago

Hello, For eventhandler extension plugin debugging purposes, I need to check the sql requests generated.

For regular posts, I use $request = $core->blog->getPosts(['sql_only'=>true]) to get the sql request. When I want to do the same with eventHandler->getEvents, I get an error, because the $rs returned by $this->core->blog->getPosts($params,$count_only) is a string instead of a record and lines 159 and 160 in class.eventhandler.php try to access $res as a record.

My fix to this issue is to enclose lines 159 & 160 with a condition test

        if(!array_key_exists('sql_only', $params) || !$params['sql_only']){
            $rs->eventHandler = $this;
            $rs->extend('rsExtEventHandlerPublic');
        }

Hope this will help! Regards, Nurbo

nikrou commented 5 years ago

Thanks. Don't hesitate to make a pull request, next time. :-)