Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

JOIN and number of records (MoreThanOnePage and others)


Go to End


1868 Views

Avatar
Jarek

Community Member, 30 Posts

9 December 2008 at 4:32am

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?