Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-832

Not quoted class name when updating entity

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-BETA4
    • Fix Version/s: 2.0-RC1
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:
      postgresql 8.4 php 5.3.2

      Description

      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.

        Issue Links

          Activity

          Paul Fariello created issue -
          Hide
          Paul Fariello added a comment -

          Here is a test case

          Mapping
          <?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>
          
          SQL
          CREATE TABLE "like"
          (
            id serial NOT NULL,
            "value" character varying,
            CONSTRAINT like_pkey PRIMARY KEY (id)
          );
          
          Class
          class Like {
          
            private $id;
            public  $value;
          }
          
          Test case
          $entity = new Like();
          $entity->value = 'toto';
          
          $doctrineEntityManager->persist($entity);
          $doctrineEntityManager->flush();
          
          $entity->value = 'tata';
          $doctrineEntityManager->flush();
          
          Show
          Paul Fariello added a comment - Here is a test case Mapping <?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> SQL CREATE TABLE "like" ( id serial NOT NULL, "value" character varying, CONSTRAINT like_pkey PRIMARY KEY (id) ); Class class Like { private $id; public $value; } Test case $entity = new Like(); $entity->value = 'toto'; $doctrineEntityManager->persist($entity); $doctrineEntityManager->flush(); $entity->value = 'tata'; $doctrineEntityManager->flush();
          Hide
          Benjamin Eberlei added a comment -

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

          Show
          Benjamin Eberlei added a comment - This issue partly depends on DBAL-57 (otherwise the testsuite keeps failing)
          Benjamin Eberlei made changes -
          Field Original Value New Value
          Link This issue relates to DBAL-57 [ DBAL-57 ]
          Hide
          Benjamin Eberlei added a comment -

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

          Show
          Benjamin Eberlei added a comment - There is really no simple fix for this issue, your proposed one breaks joined table inheritance.
          Hide
          Benjamin Eberlei added a comment -

          Found a way! fixed.

          Show
          Benjamin Eberlei added a comment - Found a way! fixed.
          Benjamin Eberlei made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Roman S. Borschel [ romanb ] Benjamin Eberlei [ beberlei ]
          Resolution Fixed [ 1 ]
          Benjamin Eberlei made changes -
          Workflow jira [ 11986 ] jira-feedback [ 14603 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback [ 14603 ] jira-feedback2 [ 16467 ]
          Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 16467 ] jira-feedback3 [ 18720 ]

          This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

          • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-832, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

            • Assignee:
              Benjamin Eberlei
              Reporter:
              Paul Fariello
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: