DDC-832: Not quoted class name when updating entity #5352

Closed
doctrinebot opened this Issue Oct 7, 2010 · 6 comments

2 participants

@doctrinebot

Jira issue originally created by user needle:

When trying to update an entity which have a reserved name. Doctrine doesn't quoted its name.

On Doctrine\ORM\Persisters\BasicEntityPersister, updateTable, $tableName is directly used to create the sql. We may use $this->_class->getQuotedTableName($this->platform) instead ?

I'm going to propose a merge for that on github.

@doctrinebot

Comment created by needle:

Here is a test case

<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity name="Like" table="`like`">
        <id name="id" type="integer" column="id">
            <generator strategy="SEQUENCE"/>
            <sequence-generator sequence-name="like*id*seq" allocation-size="1" initial-value="1"/>
        </id>

        <field name="value" column="value" type="string" />
    </entity>
</doctrine-mapping>
CREATE TABLE "like"
(
  id serial NOT NULL,
  "value" character varying,
  CONSTRAINT like_pkey PRIMARY KEY (id)
);
class Like {

  private $id;
  public  $value;
}
$entity = new Like();
$entity->value = 'toto';

$doctrineEntityManager->persist($entity);
$doctrineEntityManager->flush();

$entity->value = 'tata';
$doctrineEntityManager->flush();
@doctrinebot

Comment created by @beberlei:

This issue partly depends on DBAL-57 (otherwise the testsuite keeps failing)

@doctrinebot

Comment created by @beberlei:

There is really no simple fix for this issue, your proposed one breaks joined table inheritance.

@doctrinebot

Comment created by @beberlei:

Found a way! fixed.

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.0-RC1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment