@@ 63-73 (lines=11) @@ | ||
60 | * |
|
61 | * @return int number of rows inserted |
|
62 | */ |
|
63 | public static function loadTableFromYamlFile($table, $yamlFile) |
|
64 | { |
|
65 | $count = 0; |
|
66 | ||
67 | $data = Yaml::loadWrapped($yamlFile); // work with phpmyadmin YAML dumps |
|
68 | if (false !== $data) { |
|
69 | $count = static::loadTableFromArray($table, $data); |
|
70 | } |
|
71 | ||
72 | return $count; |
|
73 | } |
|
74 | ||
75 | /** |
|
76 | * truncateTable - empty a database table |
|
@@ 154-161 (lines=8) @@ | ||
151 | * |
|
152 | * @return bool true on success, false on error |
|
153 | */ |
|
154 | public static function saveTableToYamlFile($table, $yamlFile, $criteria = null, $skipColumns = array()) |
|
155 | { |
|
156 | $rows = static::extractRows($table, $criteria, $skipColumns); |
|
157 | ||
158 | $count = Yaml::save($rows, $yamlFile); |
|
159 | ||
160 | return (false !== $count); |
|
161 | } |
|
162 | } |
|
163 |