Пример #1
0
 /**
  * Save table data to a YAML file
  *
  * @param string           $table name of table to load without prefix
  * @param string           $yamlFile name of file containing data dump in YAML format
  * @param \CriteriaElement $criteria optional criteria
  * @param string[]         $skipColumns do not include columns in this list
  *
  * @return bool true on success, false on error
  */
 public static function saveTableToYamlFile($table, $yamlFile, $criteria = null, $skipColumns = array())
 {
     $rows = static::extractRows($table, $criteria, $skipColumns);
     $count = Yaml::save($rows, $yamlFile);
     return false !== $count;
 }
Пример #2
0
 /**
  * Return the target database condition
  *
  * @return array|bool table structure or false on error
  *
  * @throws \RuntimeException
  */
 public function getTargetDefinitions()
 {
     if (!isset($this->targetDefinitions)) {
         $this->targetDefinitions = Yaml::read($this->tableDefinitionFile);
         if (null === $this->targetDefinitions) {
             throw new \RuntimeException("No schema definition " . $this->tableDefinitionFile);
         }
     }
     return $this->targetDefinitions;
 }