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 8834755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:05:57+00:00 2026-06-14T09:05:57+00:00

Due to having to having to import data from an old non cake app

  • 0

Due to having to having to import data from an old non cake app and oddly built database table I need to pass paginate an array of records it is allowed to display – is this possible?

Normally I would reorganise the data into proper relationships etc but due to time scales etc this is not possible.

To give you more info – in my users table I have a field that contains a list of ID’s that relate to documents they are allowed to view. The field will contain something like

123,23,45,56,765,122,11.9,71,25

Each ID refers to a document the documents model. I know that normally you would create proper ACOs and AROs and let the ACL/Auth componant handle which users can access what but this isnt an option this time around. So I thought if I could do it via paginate/find it might be an option?

Any help would be really appreciated.

Thanks in advance

  • 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-06-14T09:05:58+00:00Added an answer on June 14, 2026 at 9:05 am

    You wouldn’t pass it a list of IDs, you’d use the IDs in your paginate conditions – something like below.

    (Code written off top of my head, so pardon any syntax errors…etc. It should give you the right idea/path at least):

    //Controller
    $this->loadModel('User');
    $this->loadModel('Document');
    
    $user = $this->User->findById($userId);
    
    $documentIds = explode(',', $user['User']['doc_ids']);
    
    $this->paginate = array(
        'conditions' => array(
            'id' => $documentIds
        )
    ));
    $documents = $this->paginate('Document');
    

    When you pass an array as a condtion (eg. 'id'=>$arrayOfIds), it uses MySQLs “IN” – something like:

    ... WHERE id IN (45, 92, 173)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a little confusion due to conflicting return values from CreateProcess() and GetLastError()
Due to a reverse proxy setup I'm having to pass an extra query var
I am having an Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSArray
I'm trying to create an app for the iPhone where I pull data from
I am fairly new at core data and am having a problem. My app
Excuse the simple question, the issue i'm having maybe due to lack of sleep.
I am having troubles in OpenGL due to the fact that textures have to
I am having problems downloading files possibly due to the file extensions not matching
After having a period of logshipping failures going unnoticed (due to a stopped SQL
I'm having issues in my code due to the multiple representations that a same

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.