| @@ 85-95 (lines=11) @@ | ||
| 82 | * |
|
| 83 | * @return int number of rows inserted |
|
| 84 | */ |
|
| 85 | public static function loadTableFromYamlFile($table, $yamlFile) |
|
| 86 | { |
|
| 87 | $count = 0; |
|
| 88 | ||
| 89 | $data = Yaml::loadWrapped($yamlFile); // work with phpmyadmin YAML dumps |
|
| 90 | if (false !== $data) { |
|
| 91 | $count = static::loadTableFromArray($table, $data); |
|
| 92 | } |
|
| 93 | ||
| 94 | return $count; |
|
| 95 | } |
|
| 96 | ||
| 97 | /** |
|
| 98 | * truncateTable - empty a database table |
|
| @@ 193-200 (lines=8) @@ | ||
| 190 | * |
|
| 191 | * @return bool true on success, false on error |
|
| 192 | */ |
|
| 193 | public static function saveTableToYamlFile($table, $yamlFile, $criteria = null, $skipColumns = array()) |
|
| 194 | { |
|
| 195 | $rows = static::extractRows($table, $criteria, $skipColumns); |
|
| 196 | ||
| 197 | $count = Yaml::save($rows, $yamlFile); |
|
| 198 | ||
| 199 | return (false !== $count); |
|
| 200 | } |
|
| 201 | } |
|
| 202 | ||