Doctrine_Record::unlink PHP Méthode

    public function unlink($alias, $ids = array(), $now = false)
    {
        $ids = (array) $ids;
        // fix for #1622
        if (!isset($this->_references[$alias]) && $this->hasRelation($alias)) {
            $this->loadReference($alias);
        }
        $allIds = array();
        if (isset($this->_references[$alias])) {
            if ($this->_references[$alias] instanceof Doctrine_Record) {
                $allIds[] = $this->_references[$alias]->identifier();
                if (in_array($this->_references[$alias]->identifier(), $ids) || empty($ids)) {
                    unset($this->_references[$alias]);
                }
            } else {
                $allIds = $this->get($alias)->getPrimaryKeys();
                foreach ($this->_references[$alias] as $k => $record) {
                    if (in_array(current($record->identifier()), $ids) || empty($ids)) {
                        $this->_references[$alias]->remove($k);
                    }
                }
            }
        }
        if (!$this->exists() || $now === false) {
            if (!$ids) {
                $ids = $allIds;
            }
            foreach ($ids as $id) {
                $this->_pendingUnlinks[$alias][$id] = true;
            }
            return $this;
        } else {
            return $this->unlinkInDb($alias, $ids);
        }
    }