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

  • Home
  • SEARCH
  • 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 8336729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:05:08+00:00 2026-06-09T04:05:08+00:00

I have this function write in a CakePHP model: public function getPeopleByName($name){ $this->unbindModel(array(‘hasMany’ =>

  • 0

I have this function write in a CakePHP model:

public function getPeopleByName($name){
        $this->unbindModel(array('hasMany' => array('OfficePersonTask')));

        $options['fields'] = array("Person.id", "CONCAT(Person.first_name, ' ', Person.last_name) AS full_name");

        return $this->find('all', $options);   
}

This gave me the following json:

{
   People:[
      {
         0:{
            full_name:"Groucho Marx"
         },
         Person:{
            id:"1"
         }
      },
      {
         0:{
            full_name:"Giovanni Ferretti"
         },
         Person:{
            id:"2"
         }
      }
   ]
}

I would that *full_name* will be part of Person group (actually is in a group called 0, all alone). How I can do that?

  • 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-09T04:05:10+00:00Added an answer on June 9, 2026 at 4:05 am

    Use a virtual field in the model rather than a MySQL function in your find. There are some ways to query for data as you are trying to, but you have to account for data being returned in an indexed array rather than the normal associative.

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

Sidebar

Related Questions

I have this function: int firstHeapArray (IntHeapArray h) { if(!emptyHeapArray(h)) return h.array[0]; } It's
In Scala (2.7), if I have this function: def foo(args: Array[String]) = for (arg
I have this function public static implicit operator MyClass(string v) { return new MyClass(v);
I have this function which writes content to a text file: function write($text){ fwrite($this->fp,
I have this function: function getScript(src) { document.write('<' + 'script src=' + src +
I have this function - public int GetAvgResult() { var weeklyvalues=GetWeeklyValues();//gets list of weekly
In my CakePHP application, I have a model like this: class Duck extends AppModel
I have to write this function in matlab to color segment an image based
I am newbie in ruby and regular expressions and I have this function write
I have this function: void Log::Write(string logline){ //2011-10-12 13:07:40 correct format time_t rawtime; struct

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.