sfPropelData::doDeleteCurrentData PHP Method

doDeleteCurrentData() protected method

Clears existing data from the data source by reading the fixture files and deleting the existing data for only those classes that are mentioned in the fixtures.
protected doDeleteCurrentData ( array $files )
$files array The list of YAML files.
    protected function doDeleteCurrentData($files)
    {
        // delete all current datas in database
        if (!$this->deleteCurrentData) {
            return;
        }
        rsort($files);
        foreach ($files as $file) {
            $data = sfYaml::load($file);
            if ($data === null) {
                // no data
                continue;
            }
            $classes = array_keys($data);
            foreach (array_reverse($classes) as $class) {
                $class = trim($class);
                if (in_array($class, $this->deletedClasses)) {
                    continue;
                }
                // Check that peer class exists before calling doDeleteAll()
                $peerClass = constant($class . '::PEER');
                if (!class_exists($peerClass)) {
                    throw new InvalidArgumentException(sprintf('Unknown class "%sPeer".', $class));
                }
                $this->log(sprintf('deleting data from %s', $class));
                // bypass the soft_delete behavior if enabled
                $deleteMethod = method_exists($peerClass, 'doForceDeleteAll') ? 'doForceDeleteAll' : 'doDeleteAll';
                call_user_func(array($peerClass, $deleteMethod), $this->con);
                $this->deletedClasses[] = $class;
            }
        }
    }