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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:45:52+00:00 2026-06-03T19:45:52+00:00

I found an odd behaviour of Doctrine’s reverse engineering process, just create two simple

  • 0

I found an odd behaviour of Doctrine’s reverse engineering process, just create two simple tables tied by a simple 1-n relationship, take a look at the snap of the folowing SQL code:

SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

DROP SCHEMA IF EXISTS `ACME` ;
CREATE SCHEMA IF NOT EXISTS `ACME` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `ACME` ;

-- -----------------------------------------------------
-- Table `ACME`.`task`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ACME`.`task` ;

CREATE  TABLE IF NOT EXISTS `ACME`.`task` (
  `id_task` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `description` VARCHAR(45) NULL ,
  PRIMARY KEY (`id_task`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `ACME`.`tag`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `ACME`.`tag` ;

CREATE  TABLE IF NOT EXISTS `ACME`.`tag` (
  `id_tag` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(50) NULL ,
  `task_id` INT UNSIGNED NOT NULL ,
  PRIMARY KEY (`id_tag`) ,
  INDEX `fk_tag_task` (`task_id` ASC) ,
  CONSTRAINT `fk_tag_task`
    FOREIGN KEY (`task_id` )
    REFERENCES `ACME`.`task` (`id_task` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

I have a Symfony2 netbeans project at

/Applications/MAMP/htdocs/Acme

and from that location, according to

http://symfony.com/doc/current/cookbook/doctrine/reverse_engineering.html

in a terminal I did:

$ ./../../bin/php/php5.3.6/bin/php app/console doctrine:mapping:convert yml ./src/Acme/TaskBundle/Resources/config/doctrine/ --from-database --force
Processing entity "Tag"
Processing entity "Task"

Exporting "yml" mapping information to "/Applications/MAMP/htdocs/Acme/src/Acme/TaskBundle/Resources/config/doctrine"

$ ./../../bin/php/php5.3.6/bin/php app/console doctrine:mapping:import Acme\TaskBundle yml
Importing mapping information from "default" entity manager
  > writing /Applications/MAMP/htdocs/Acme/src/Acme/TaskBundle/Resources/config/doctrine/Tag.orm.yml
  > writing /Applications/MAMP/htdocs/Acme/src/Acme/TaskBundle/Resources/config/doctrine/Task.orm.yml

$ ./../../bin/php/php5.3.6/bin/php app/console doctrine:generate:entities Acme\TaskBundle
Generating entities for bundle "AcmeTaskBundle"
  > backing up Tag.php to Tag.php~
  > generating Acme\TaskBundle\Entity\Tag
  > backing up Task.php to Task.php~
  > generating Acme\TaskBundle\Entity\Task

The fact is that it only seems ok, because if you take a look at “Tag.orm.yml”:

Acme\TaskBundle\Entity\Tag:
  type: entity
  table: tag
  fields:
    idTag:
      id: true
      type: integer
      unsigned: false
      nullable: false
      column: id_tag
      generator:
        strategy: IDENTITY
    name:
      type: string
      length: 50
      fixed: false
      nullable: true
  oneToOne:
    task:
      targetEntity: Task
      cascade: {  }
      mappedBy: null
      inversedBy: null
      joinColumns:
        task_id:
          referencedColumnName: id_task
      orphanRemoval: false
  lifecycleCallbacks: {  }

It created a oneToOne relationship and not a oneToMany !

If you need any more confirmation, here are Task.php and Tag.php:

Task.php

namespace Acme\TaskBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Acme\TaskBundle\Entity\Task
 */
class Task
{
    /**
     * @var integer $idTask
     */
    private $idTask;

    /**
     * @var string $description
     */
    private $description;


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

    /**
     * Set description
     *
     * @param string $description
     */
    public function setDescription($description)
    {
        $this->description = $description;
    }

    /**
     * Get description
     *
     * @return string 
     */
    public function getDescription()
    {
        return $this->description;
    }
}

Tag.php

namespace Acme\TaskBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Acme\TaskBundle\Entity\Tag
 */
class Tag
{
    /**
     * @var integer $idTag
     */
    private $idTag;

    /**
     * @var string $name
     */
    private $name;

    /**
     * @var Acme\TaskBundle\Entity\Task
     */
    private $task;


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

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set task
     *
     * @param Acme\TaskBundle\Entity\Task $task
     */
    public function setTask(\Acme\TaskBundle\Entity\Task $task)
    {
        $this->task = $task;
    }

    /**
     * Get task
     *
     * @return Acme\TaskBundle\Entity\Task 
     */
    public function getTask()
    {
        return $this->task;
    }
}

Do you guys have met this problem too?
Thank you in advance

  • 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-03T19:45:54+00:00Added an answer on June 3, 2026 at 7:45 pm

    I made a critical discovery: using xml instead of yml in the first command, the one with doctrine:mapping:convert, IT WORKS IN THE RIGHT WAY.

    Goddamned stupid bug.

    Linuxatico

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

Sidebar

Related Questions

I found an odd problem when I run a simple csh script on Solaris.
I have found some odd behaviour while I was using the PHP function in_array()
Based on the following question , I found some odd behaviour of the c#
I found something very odd today: If you create objects with a constructor function
While writing an optimized ftol function I found some very odd behaviour in GCC
I've just noticed a very odd behaviour with VS2010. At some point since install,
I'm seeing some odd behaviour here using PrincipalContext.ValidateCredentials . The set-up is two Active
I just found an odd behavior within our application. We have a rich:tabPanel switchType=ajax
I found this odd behavior and I'm breaking my brains with this... anyone has
I found it odd that a string method operation on a string object doesn't

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.