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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:50:14+00:00 2026-05-25T19:50:14+00:00

In CakePHP function edit I use read() function as: $this->data = $this->Article->read(null, $id); It

  • 0

In CakePHP function edit I use read() function as:

$this->data = $this->Article->read(null, $id);

It brings all fields of $id. Now, what I am trying to tweak to give one more condition in read() to get articles only if user logged in is related to it.

eg:

 $this->Article->user_id = $user_id;
 $this->Article->id = $id;
 $this->Article->read();

And obviously it want work as read() brings data only w.r.t. $id (primary key).

My question:

  1. Is there any way to tweak read function with condition more than $id ? Because it will just need to add a one line in all my controllers if it works ?
  2. Or I have to use long code of find() function to get is the only option ?

Any best solution will be appreciable.

  • 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-25T19:50:15+00:00Added an answer on May 25, 2026 at 7:50 pm

    If you really must do thise, you could use OOP techniques to override the way the core method works.

    Just copy the Model::read() method to your AppModel class and make the changes necessary.

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

Sidebar

Related Questions

function new_photo() { if( !empty($this->data)) { $this->data['Photo']['showcase_id'] = $this->Session->read('CurrShowcase.id'); $this->data['Photo']['added'] = date(Y-m-d H:i:s); $this->Showcase->Photo->save($this->data);
I'm using the CakePHP blog example: function add() { if (!empty($this->data)) { if ($this->Post->saveAll($this->data))
I'm trying to upload a file with cakePHP. This is the view: echo $form->create(null,
I am learning Session function in CakePhp, and see some examples like this on
i am new to cakephp, and also new to ajax. the function i trying
I try to send data form ajax to cakephp cotroller function loadtooltip(obj, $user_id) {
Using CakePHP 1.3 I'm trying to save some data to a MySQL database. The
CakePHP Newbie :) I am having trouble accessing another controller and passing that data
I have a cakephp installation in the root of my domain. Now it turns
I am learning the locale function in Cakephp. I am not sure how to

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.