Doctrine_Record::prepareIdentifiers PHP Méthode

prepareIdentifiers() private méthode

prepareIdentifiers prepares identifiers for later use
private prepareIdentifiers ( boolean $exists = true ) : void
$exists boolean whether or not this record exists in persistent data store
Résultat void
    private function prepareIdentifiers($exists = true)
    {
        switch ($this->_table->getIdentifierType()) {
            case Doctrine_Core::IDENTIFIER_AUTOINC:
            case Doctrine_Core::IDENTIFIER_SEQUENCE:
            case Doctrine_Core::IDENTIFIER_NATURAL:
                $name = $this->_table->getIdentifier();
                if (is_array($name)) {
                    $name = $name[0];
                }
                if ($exists) {
                    if (isset($this->_data[$name]) && $this->_data[$name] !== self::$_null) {
                        $this->_id[$name] = $this->_data[$name];
                    }
                }
                break;
            case Doctrine_Core::IDENTIFIER_COMPOSITE:
                $names = $this->_table->getIdentifier();
                foreach ($names as $name) {
                    if ($this->_data[$name] === self::$_null) {
                        $this->_id[$name] = null;
                    } else {
                        $this->_id[$name] = $this->_data[$name];
                    }
                }
                break;
        }
    }