Jump to content

Is there a way to convert a selector in SQL using PW engine?


Go to solution Solved by teppo,

Recommended Posts

  • Solution

None that I'm aware of. Of course you can always use PageFinder for this, but it's going to look a bit hacky:

$selectors = new Selectors("template=blog-post, limit=5, sort=name");
$pagefinder = new PageFinder();
$options = array('returnVerbose' => true);
$sql = $pagefinder->getQuery($selectors->getArray(), $options)->getQuery();
// .. and so on, depending on what exactly you're looking for
  • Like 9
Link to post
Share on other sites
  • 1 year later...

This was helpful debugging one issue. In later PW-versions you have to add findOne into $options array to make it work:

$selectors = new Selectors("template=blog-post, limit=5, sort=name");
$pagefinder = new PageFinder();
$options = array('returnVerbose' => true, 'findOne' => false);
$sql = $pagefinder->getQuery($selectors, $options)->getQuery();
  • Like 6
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...