Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » JOIN and number of records (MoreThanOnePage and others)

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1094 Views
  • Jarek
    Avatar
    Community Member
    30 Posts

    JOIN and number of records (MoreThanOnePage and others) Link to this post

    Hello

    I'm using JOIN to get articles commented by user. Query works ok, but the number of result records is wrong. Predefined variables (NewsArticles.Pages, MoreThanOnePage and others) have wrong values (to big).
    This is my query:

    $doSet = DataObject::get(
    $callerClass = "ArticlePage",
    $filter = "`SiteTree`.ParentID = '".$this->ID."' AND `Name` = '".PssMember::currentUser()->Login."'",
    $sort = "`SiteTree`.Created DESC",
    $join = " JOIN `PageComment` ON `ArticlePage`.ID = `PageComment`.ParentID",
    $limit = "{$SQL_start},2"
    );

    How can I get correct number of records? When use JOINs I have to manulay set this variables?

    1094 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.