Search

Are these extensions primarily for extension development? I’ve never understood their application…

Are these extensions primarily for extension development

For writing custom Data Sources, mostly.

By the way: Are there any plans to merge SymQL/SymQuery and Symphony’s Entry Manager in version 3?

SymQL is just a wrapper for the EntryManager. Considering the Manager classes are gone in S3 entirely (for now) I’ll say no, they won’t be merged. But it will be the role of the Core WG in the near future to define the core API of Symphony 3, which will naturally involve a useful API for querying entries (which Symphony should be using internally aswell). So I hope some of the concepts that SymQL/SymQuery use will be inspiration when designing the new API.

Hi Nick,

Is it possible to get data from 2 sections at once using SymQL?

Something like this: (sectionA and sectionB would both have a date and publish field)

$query = new SymQLQuery('all-publications');
$query
->select('system:id')
->from('sectionA','sectionB')
->where('publish', 'yes')
->orderby('date', 'desc')
->perPage(10)
->page(1);
$result = SymQL::run($query);

Nope. SymQL uses the core EntryManager class under the hood, which assumes your data will be in a single section. To achieve this you’ll need to select from each section individually and merge the results.

Hmm, that wouldn’t help me out. I guess i will have to do the query manually …

Select entry id’s sorted by their common date fields where published in in sections A or B … and pass those ID’s as ds-parameter for further chaining…

Update for whom it may help…:

SELECT 
    Adate.entry_id as id, 
    Adate.value as date 
FROM 
    [sectionA_date_table] as `Adate`,
    [sectionA_publish_table] as `Apub`
WHERE 
    Adate.entry_id=Apub.entry_id 
AND 
    Apub.value='yes'

UNION

SELECT 
    Bdate.entry_id as id, 
    Bdate.value as date 
FROM 
    [sectionB_date_table] as `Bdate`,
    [sectionB_publish_table] as `Bpub`
WHERE 
    Bdate.entry_id=Bpub.entry_id 
AND 
    Bpub.value='yes'

ORDER BY date desc LIMIT [page],[entries per page]

You could JOIN the two fields from Section A (the tables which represent the Date field and the Checkbox field), JOIN the similar fields from Section B, UNION them (so that they appear as one table), and you should be there.

Nice cross-commenting action ;) No JOIN necessary … is it?

now all i have to do is output a comma seperated list of found id’s as a ds-param and the rest is just plain ‘ol symphony chaining magic i guess. :)

Thanx Nick!

Hi everyone, i am a newbie here and i have some doubts. I am trying to figure how to use Symphony only as a backend and get the data in a direct way (without creating datasources) and inside arrays (no need to parse a xml from an RESTful url).

So, can SymQL be accessed from an external php and get the entry data? Any other way to do that?

Thanks!

So, can SymQL be accessed from an external php and get the entry data?

No. SymQL relies on you writing your PHP within the scope of Symphony, i.e. you need to include and instiate a Symphony object. SymQL is designed for writing your own custom data sources for use within PHP.

Any other way to do that?

Depends on what you need it for. The best way is probably going to be a RESTful URL structure so that you can read the data as XML or JSON. If JSON, you’d have it directly as an object that you can manipulate. There is a REST API extension that lets you get data as XML, JSON or YAML.

SymQL updated to version 0.6.1 on 17th of February 2011

Thanks ! nice extension !

whether it is possible to implement like operator in SymQL

something like this

"SELECT * FROM tablea WHERE field2 LIKE '%roger%'"

SymQL maps on to the filtering syntax of Symphony fields, so if the field supports it, SymQL supports it too. The closest we have currently is REGEXP on Text Input and Textarea fields. They do not support LIKE. The README has an example of using this:

$query->where('title', 'regexp:CSS');

This should have the same effect as a LIKE with the % wildcard on either side of the string.

Nick, I think I found a bug in the creation of filters. In my case I couldn't filter a SBL by multiple IDs. Reverting the linked line to the previous state fixed it for me.

Is it possible to order by the count of a select field or bi-link field? I've tried:

$query->orderby('article:count', 'DESC');

But that doesn't seem to work.

Nope, fraid not. You can only order by the options that show up in the sort by list in the data source editor.

Hi Nick,

I filed an issue regarding a fatal error / allowed memory error I got.

I am using SymQL, but now it's causing memory issues on a section with more than 3600 entries (each entry has 31 fields). It happens in the SymQL::run()-function

Is there anyway to use something like "SELECT DISTINCT"?

Thanks!

Create an account or sign in to comment.

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