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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:07:45+00:00 2026-06-17T22:07:45+00:00

Access $this->params and $this->data in components. class LoginComponent extends Object { /* */ public

  • 0

Access $this->params and $this->data in components.

class LoginComponent extends Object {
   /*  */
   public function login() {   
      pr($this->params);
      pr($this->data);
   }
}

I am using this in cake v1.2. I would like to know solution of this in v1.2 as well as v2.1. Please give me a suggestion.

  • 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-17T22:07:46+00:00Added an answer on June 17, 2026 at 10:07 pm

    Have a look at some components in your lib. I know this for Cake 2.x, not for 1.2.x. update: as mark mentioned in the comments, this works the same for the 1.x versions.

    For example, when I open the SecurityComponent I will find a function called startup(). This method defines itself as:

    public function startup(Controller $controller) {
         //Rest of code goes here
    }
    

    as you can see, they import the Controller object. What you could right now is access the Controlelr methods and variables. Because as you might know: the $this when calling $this->data refers to the Controller.

    So, if I store this $controller in a protected variable called $_Controller in my component, I can easily access the data and params like so:

    # CakePhp 2.x
    $this->_Controller->request->data;
    $this->_Controller->request->params;
    
    # CakePhp 1.x
    $this->_Controller->data;
    $this->_Controller->params;
    

    Have a look at this answer as well.

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

Sidebar

Related Questions

So I need to access this service from my rails app. I'm using soap4r
Possible Duplicate: How to access this attribute using jquery, given a div defined by
So I'm trying to access this api https://www.clarityaccounting.com/api-docs/ using SUDS. Here is the code
Protected Means, we can access this member only in a deriving class, and internal
I'm using a servlet to access the MySQL data. I already have the code
I am using an instance of the this class to pass necessary values to
I am using the MS Enterprise Library 5.0 (data access blocks) for the main
We've porting code to Delphi XE2, and need to change our data access components
I'm trying to access this.collection from within a setInterval . However, this isn't bound.
Possible Duplicate: How Do I Access This Variable? Lets say I have the code:

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.