Author:
nickdunn
Version:
0.6.1
Released:
17 February 2011
Category:
Other

Pending#1: Pagination problems

I’m using this extension to build some custom data sources. In this case I’m trying to fetch entries that match the following conditions:

  1. Match a list with German tags (deutsche-tags) OR English tags (englische-tags)
  2. AND match a specific site (select box, bereich).

While my data source returns the correct entries the pagination goes mad as it return the following information

<pagination total-entries="11" total-pages="2" entries-per-page="10" current-page="1" />

This would be the correct information:

<pagination total-entries="5" total-pages="1" entries-per-page="10" current-page="1" />

I suppose the wrong entry count is a result of tags with the same name in the German and the English list but I’m not sure. Any idea how/where to fix this?

This is how the grab() function of my data source looks like:

public function grab(&$param_pool=NULL){

    require_once(EXTENSIONS . '/symql/lib/class.symql.php');
    $dsPage = ($this->_env['env']['url']['seite'] ? $this->_env['env']['url']['seite'] : 1);

    // Query 
    $query = new SymQLQuery('stichwort');
    $query->select(implode(', ', array(
        'primaertitel',
        'primaertext: formatted',
        'sekundaertitel',
        'primaersprache',
        'bereich',
        'bilder',
        'datum',
        'deutsche-tags',
        'englische-tags'
    )));
    $query->from('inhalte');
    $query->where('deutsche-tags', $this->_env['env']['url']['tag']);
    $query->where('englische-tags', $this->_env['env']['url']['tag'], SymQL::DS_FILTER_OR);
    $query->where('bereich', $param_pool['ds-kontext'], SymQL::DS_FILTER_AND);
    $query->orderby('datum', 'desc');
    $query->perPage(10);
    $query->page($dsPage);

    // Result
    $result = SymQL::run($query);
    return $result;

}

Could you try:

var_dump(SymQL::getDebug());die;

This should dump out the JOIN and WHERE strings SymQL is creating. Sounds a bit like this hack isn’t working perhaps.

While my data source returns the correct entries the pagination goes mad as it return the following information

Are you 100% sure the entries are correct but pagination not? SymQL doesn’t do anything clever with pagination values, it just gets them from the EntryManager. So if there’s a bug with this, it sounds like it could be with EntryManager.

From what I understand there is a long running bug with the Taglist field that I think is causing this issue, not SymQL.

Brendan, do you know where this bug is caused inside the taglist field?

This is how the debug looks like:

Array
(
    [queries] => Array
        (
            [Resolve section and fields] => 0
            [Fetch entries] => 2
            [Total] => 2
        )

    [sql] => Array
        (
            [joins] => 
                    LEFT JOIN
                        `sym_entries_data_13` AS t13_1
                        ON (e.id = t13_1.entry_id)

                    LEFT JOIN
                        `sym_entries_data_14` AS t14_1
                        ON (e.id = t14_1.entry_id)

                    LEFT JOIN
                        `sym_entries_data_18` AS t18_3
                        ON (e.id = t18_3.entry_id)

            [where] => 
                    AND (
                        t13_1.value IN ('calendar')
                        OR t13_1.handle IN ('calendar')
                    )
                OR (
                        t14_1.value IN ('calendar')
                        OR t14_1.handle IN ('calendar')
                    )
                    AND (
                        t18_3.value IN ('Nils')
                        OR t18_3.handle IN ('Nils')
                    )

        )

)

The resulting variable $where returns this:

AND ( t37_1.value IN ('Nils') OR t37_1.handle IN ('Nils') ) AND ( t18_1.value IN ('Texte') OR t18_1.handle IN ('Texte') )

The resulting variable $where returns this:

AND ( t37_1.value IN ('Nils') OR t37_1.handle IN ('Nils') ) AND ( t18_1.value IN ('Texte') OR t18_1.handle IN ('Texte') )

Sorry - the edit function seems to be broken …

Brendan, could you elaborate on the Taglist bug please? Haven’t come across that one before.

To be closed.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details