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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:32:46+00:00 2026-05-17T21:32:46+00:00

I am trying to perform a simple join on two tables and am having

  • 0

I am trying to perform a simple join on two tables and am having trouble finding the right syntax to use – I know i am missing something simple.

From the ‘users’ table i need the id (working fine)
and from the ‘meta’ table i need the last_name (not working)

$q = Doctrine_Query::create()
->from('Users u')
->leftJoin('u.Meta m');

$users = $q->execute();

//attempt 1    
foreach($users as $user){
    $user_array[$user->id] = $user->last_name;
}

//attempt 2   
foreach($users as $user){
    $user_array[$user->id] = $user->m.last_name;
}

I’ve also tried adding an explicit
select(u.id, m.last_name)
to the query but the result is always the same

Uncaught exception 'Doctrine_Record_UnknownPropertyException' with message
'Unknown record property / related component "last_name" on "Users"

Obviously the property I am trying to access is not in the users table.
-The query works fine, as if I don’t request the last_name field – my application works as expected..

//proof   
foreach($users as $user){
    $user_array[$user->id] = 'fake_last_name!';
}

Can anyone provide a simple example of how I’m meant to do this (even a link to a page in the documentation) all of the examples of JOINING DQL in the doucmentation output the query to SQL instead of iterating the results…

Doctrine Documentation: Join Syntax

  • 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-17T21:32:46+00:00Added an answer on May 17, 2026 at 9:32 pm

    I managed to work it out…

    http://www.doctrine-project.org/documentation/manual/1_2/en/working-with-models

    foreach($users as $user){
        $user_array[$user->id] = $user->Meta->last_name;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to perform a join on two tables in MySQL, and the
I'm trying to perform a simple LINQ query on the Columns property of a
I'm trying to perform a simple INSERT and return the identity (auto-incrementing primary key).
I'm trying to port an existing AJAX app to Flex, and having trouble with
Trying to perform a single boolean NOT operation, it appears that under MS SQL
I'm trying to perform a LINQ query on a DataTable object and bizarrely I
I'm trying to perform a SQL query through a linked SSAS server. The initial
I'm trying to perform a bitwise NOT in SQL Server. I'd like to do
I am trying to perform some unit testing on the iphone but for some
I'm trying to perform a group by action on an aliased column (example below)

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.