Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6658373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:54:25+00:00 2026-05-26T01:54:25+00:00

In applying the answer from a previous question , I tried overriding one of

  • 0

In applying the answer from a previous question, I tried overriding one of CakePHP’s built-in pagination methods:

function paginateCount($conditions = null, $recursive = 0, $extra = array()) {
    if (isset($extra['group'])) {
        for ($i=0; $i<count($extra['group']);$i++) {
            if (strpos(strtolower($extra['group'][$i]),'having')!==false) unset($extra['group'][$i]);
        }
        exit();
    }
    $count = parent::paginateCount($conditions, $recursive, $extra);
    return $count;
}

The problem is that this seems to cause Cake to do a MySQL query consisting simply of the name of the method. Obviously this doesn’t work and throws an error:

SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘paginateCount’ at line 1

Since I have debugging enabled, I can see that where there would normally be the paginateCount() query:

1: SELECT COUNT(*) AS `count` FROM `tournaments` AS `Tournament` WHERE 1 = 1 

I just get:

1: paginateCount

I’ve obviously misunderstood PHP’s inheritance operators. My function seems to be returning the name of the function it is overriding rather than it’s value.

How can I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:54:25+00:00Added an answer on May 26, 2026 at 1:54 am

    This usually happens when CakePHP can’t find the method in the model or attached behaviors.

    It then passes the call to the datasource (hoping it has the method and knows what to do) and that’s why you get this error.

    I would check things are what they seem (is the method in the right model, is Cake making an automodel because of incorrect filenaming, etc.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was Googling for applying horizontal page curl in iPhone. I also tried this
I have code listed here: Threading and Sockets . The answer to that question
This is a syntax question. I have a generic class which is inheriting from
I have asked the first part of this question before, but with no answer
edit: many thanks for all the answers. Here are the results after applying the
When applying the MVP pattern to ASP.NET applications, where does using AJAX to post
How to approach applying for a job at a company owned by a friend?
I have a problem applying the DebuggerDisplay attribute on a generic class: [DebuggerDisplay(--foo--)] class
The backstory: I am applying a filter to a TableView. It's a simple 'find
I am applying style to div using JavaScript it appears well at the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.