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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:39:11+00:00 2026-05-27T10:39:11+00:00

EDIT Let’s take the following model : The following entities are generated with the

  • 0

EDIT

Let’s take the following model :

enter image description here

The following entities are generated with the command doctrine:mapping:import :

class Toto
{
    /**
     * @var integer $idtoto
     *
     * @ORM\Column(name="idtoto", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $idtoto;



    /**
     * Get idtoto
     *
     * @return integer 
     */
    public function getIdtoto()
    {
        return $this->idtoto;
    }
}

class Tata
{
    /**
     * @var integer $idtata
     *
     * @ORM\Column(name="idtata", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $idtata;

    /**
     * @var Toto
     *
     * @ORM\ManyToOne(targetEntity="Toto")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="idtoto", referencedColumnName="idtoto")
     * })
     */
    private $idtoto;



    /**
     * Get idtata
     *
     * @return integer 
     */
    public function getIdtata()
    {
        return $this->idtata;
    }

    /**
     * Set idtoto
     *
     * @param Creatis\SaisieBundle\Entity\Toto $idtoto
     */
    public function setIdtoto(\Creatis\SaisieBundle\Entity\Toto $idtoto)
    {
        $this->idtoto = $idtoto;
    }

    /**
     * Get idtoto
     *
     * @return Creatis\SaisieBundle\Entity\Toto 
     */
    public function getIdtoto()
    {
        return $this->idtoto;
    }
}

Why is the relation OneToMany in class Toto NOT generated (had to type it by hand) :

/**
 * @ORM\OneToMany(targetEntity="Tata", mappedBy="idToto")
 */
private $tatas;

Is there an option to put in the command line ?

  • 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-27T10:39:12+00:00Added an answer on May 27, 2026 at 10:39 am

    Within leftJoin, you just have to use the name of your relation attribute as defined in the Tata class. The second parameter only defines the key you can use in the statement. If your relations are correct, doctrine does the join automatically:

    class TataRepository extends EntityRepository{
      public function getRelation(){
        $qb = $this->createQueryBuilder('tata')
          ->leftJoin('tata.idtoto', 'toto');
        return $qb->getQuery()->getResult();
      }
    }
    

    If you don’t want to join with the foreign key but some other fields, you have to add a thrid parameter to leftJoin which does the matching, like toto.field1 = tata.field2.

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

Sidebar

Related Questions

Edit: let me include my code so I can get some specific help. import
Please let me know if you have any idea about it. Thanks EDIT What
So. Let's say I were to make a hex editor to edit... oh... let's
EDIT: Let me turn this into a straight SQL question... I have a varbinary(max)
What is the string terminator sequence for a UTF-16 string? EDIT: Let me rephrase
(EDIT: Let's title this, Lessons in how measurements can go wrong. I still haven't
Edit: Let us assume the classes actually do not share an interface! Major slip
EDIT : Let's try this again. This time I've used the AdventureWorks sample database
I'm looking to analyze and compare the following `signals': (Edit: better renderings here: oscillations
Edit: This question was written in 2008, which was like 3 internet ages ago.

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.