Changeset 5027

Show
Ignore:
Timestamp:
10/02/08 02:51:45 (3 months ago)
Author:
jwage
Message:

[1.1] fixes #1307 Added ability to set default charset/collate options at manager, connection and record level.

Location:
branches/1.1
Files:
1 added
6 modified

Legend:

Unmodified
Added
Removed
  • branches/1.1/lib/Doctrine.php

    r5018 r5027  
    198198    const ATTR_AUTO_ACCESSOR_OVERRIDE   = 165; 
    199199    const ATTR_AUTO_FREE_QUERY_OBJECTS  = 166; 
     200    const ATTR_DEFAULT_TABLE_CHARSET    = 167; 
     201    const ATTR_DEFAULT_TABLE_COLLATE    = 168; 
    200202 
    201203    /** 
  • branches/1.1/lib/Doctrine/Configurable.php

    r5018 r5027  
    184184            case Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE; 
    185185            case Doctrine::ATTR_AUTO_FREE_QUERY_OBJECTS; 
     186            case Doctrine::ATTR_DEFAULT_TABLE_CHARSET; 
     187            case Doctrine::ATTR_DEFAULT_TABLE_COLLATE; 
    186188 
    187189                break; 
     
    462464 
    463465    /** 
     466     * Set the charset 
     467     * 
     468     * @param string $charset 
     469     */ 
     470    public function setCharset($charset) 
     471    { 
     472        $this->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_CHARSET, $charset); 
     473    } 
     474 
     475    /** 
     476     * Get the charset 
     477     * 
     478     * @return mixed 
     479     */ 
     480    public function getCharset() 
     481    { 
     482        return $this->getAttribute(Doctrine::ATTR_DEFAULT_TABLE_CHARSET); 
     483    } 
     484 
     485    /** 
     486     * Set the collate 
     487     * 
     488     * @param string $collate 
     489     */ 
     490    public function setCollate($collate) 
     491    { 
     492        $this->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_COLLATE, $collate); 
     493    } 
     494 
     495    /** 
     496     * Get the collate 
     497     * 
     498     * @return mixed $collate 
     499     */ 
     500    public function getCollate() 
     501    { 
     502        return $this->getAttribute(Doctrine::ATTR_DEFAULT_TABLE_COLLATE); 
     503    } 
     504 
     505    /** 
    464506     * sets a parent for this configurable component 
    465507     * the parent must be configurable component itself 
  • branches/1.1/lib/Doctrine/Connection.php

    r5020 r5027  
    675675 
    676676    /** 
    677      * Set the charset on the current connection 
    678      * 
    679      * @param string    charset 
    680      */ 
    681     public function setCharset($charset) 
    682     { 
    683  
    684     } 
    685  
    686     /** 
    687677     * Quote a string so it can be safely used as a table or column name 
    688678     * 
  • branches/1.1/lib/Doctrine/Table.php

    r4957 r5027  
    243243        $this->_filters[]  = new Doctrine_Record_Filter_Standard(); 
    244244        $this->_repository = new Doctrine_Table_Repository($this); 
    245          
     245 
     246        if ($charset = $this->getAttribute(Doctrine::ATTR_DEFAULT_TABLE_CHARSET)) { 
     247            $this->_options['charset'] = $charset; 
     248        } 
     249        if ($collate = $this->getAttribute(Doctrine::ATTR_DEFAULT_TABLE_COLLATE)) { 
     250            $this->_options['collate'] = $collate; 
     251        } 
     252 
    246253        $this->construct(); 
    247254    } 
  • branches/1.1/tests/run.php

    r5025 r5027  
    124124$tickets->addTestCase(new Doctrine_Ticket_1304_TestCase()); 
    125125$tickets->addTestCase(new Doctrine_Ticket_1305_TestCase()); 
     126$tickets->addTestCase(new Doctrine_Ticket_1307_TestCase()); 
    126127$tickets->addTestCase(new Doctrine_Ticket_1315_TestCase()); 
    127128$tickets->addTestCase(new Doctrine_Ticket_1323_TestCase()); 
  • branches/1.1/UPGRADE_TO_1_1

    r5021 r5027  
    2121    $users = $q->execute(); // $q->free() is triggered 
    2222 
    23 [r5019](http://trac.doctrine-project.org/changeset/5019) - `unlink()` and `link()` have been changed to not delete references until `save()` is called on the object 
     23[r5019](http://trac.doctrine-project.org/changeset/5019) - `unlink()` and `link()` have been changed to not delete references until `save()` is called on the object. Also, fixed synchronizeWithArray() to synchronize many to many relationships. 
    2424 
    2525    // Does not link until save() 
     
    3131    $user = Doctrine::getTable('User')->find(1); 
    3232    $user->link('Groups', array(1, 2, 3), true); 
     33 
     34    $user = Doctrine::getTable('User')->find(1); 
     35    $userArray = array( 
     36        'Group' => array( 
     37            '_identifiers' => array( 
     38                1 => true, 
     39                2 => true, 
     40                3 => false) 
     41        )); 
     42 
     43    $user->synchronizeWithArray($userArray); 
     44    $user->save();