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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:49:25+00:00 2026-06-18T04:49:25+00:00

I have 2 entities: author and person. In the author entity, there is a

  • 0

I have 2 entities: author and person.

In the author entity, there is a person field which is in fact the person object:

/**
 * @ORM\ManyToOne(targetEntity="Person", inversedBy="submission_authors")
 * @ORM\JoinColumn(name="person_id", referencedColumnName="id")
 */
protected $person;

Now, in the repository: AuthorRepository, I would like to search for some authors by their firstname. To do this, I need to access the person object for the corresponding author ans look on the person’s firstname.

I tryed:

 public function searchAuthors($q)
{
    $authQB = $this->createQueryBuilder( 'a' )
    ->select('a')
    ->where("a.person.firstname LIKE '%".$q."%'");

    return $authQB->getQuery()->getResult();
}

But the problem is that I am geting an error:

 [Syntax Error] line 0, col 78: Error: Expected Doctrine\ORM\Query\Lexer::T_LIKE, got '.' 

Coud you please help me on how to resolve 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-18T04:49:26+00:00Added an answer on June 18, 2026 at 4:49 am

    You’d have to access your person relation like this:

    $authQB = $this->createQueryBuilder( 'a' )
        ->select('a')
        ->leftJoin('a.person', 'p')
       //...
    

    To learn a bit more about query builder and joint tables:

    • This SO post.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two entities: Message entity class Message { /** * @ManyToOne(targetEntity=User) *
I have entities Basket and BasketItem : /** * Acme\BasketBundle\Entity\Basket * * @ORM\Entity(repositoryClass=Acme\BasketBundle\Repository\BasketRepository) *
I have entities: Tweet and User . Tweet has an author , which is
If I have entities like: @Entity public class Person { public String name; @OneToMany
I have entities which are divided into categories. Each entity can belong to many
I have entities Group and User . the Group entity has Users property which
I have three entities. Author Newspaper Dissertation Newspaper and Dissertation both can have one
I am using Entity Framework and DevExpress 10.5 XtraGrid. Imagine that we have entities
I have 2 entities in CoreData (which are relevant to this). Let's call them
I have such doctrine entities: <?php namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; /** * @Entity(repositoryClass=App\Repository\Page) *

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.