Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-2139

Table collate/charset doesn't inherits from database

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: ORM, Tools
    • Security Level: All
    • Environment:
      Symfony2

      Description

      Using symfony2 command doctrine:schema:create the tables and Varchar fields are Collate/Charset are not inherited from database. I changed MySQL defaults to latin1/latin1_general_ci; The doctrine:database:create works; but tables and fields don't. So I found there is a code on MySqlPlataform.php:

      if ( ! isset($options['charset'])) {
      $options['charset'] = 'utf8';
      }

      if ( ! isset($options['collate'])) {
      $options['collate'] = 'utf8_unicode_ci';
      }

      $query .= 'DEFAULT CHARACTER SET ' . $options['charset'];
      $query .= ' COLLATE ' . $options['collate'];

      So if you don't pass collate and charset as entity options, it will put utf8 and utf8_unicode_ci instead of dabatase default charset.

      My suggestion is to change a little bit to:

      if (isset($options['charset'])) {
      $query .= 'DEFAULT CHARACTER SET ' . $options['charset'];
      }

      if (isset($options['collate'])) {
      $query .= ' COLLATE ' . $options['collate'];
      }

        Activity

        williamk William Knak created issue -
        williamk William Knak made changes -
        Field Original Value New Value
        Labels charset, collate, collation, mysql utf, utf8 charset collate collation mysql utf utf8
        Hide
        beberlei Benjamin Eberlei added a comment -

        If we change it, then it will be like before and users disliked that very much. The decision is to use UTF-8 as default and everybody else has to change the information instead of the other way around.

        Show
        beberlei Benjamin Eberlei added a comment - If we change it, then it will be like before and users disliked that very much. The decision is to use UTF-8 as default and everybody else has to change the information instead of the other way around.
        beberlei Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]

        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={expand=changesets[0:20].revisions[0:29],reviews, query=DDC-2139}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            williamk William Knak
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: