Changes static methods to be normal public methods.
This commit is contained in:
parent
1e1090700c
commit
2fe7b95fba
@ -185,7 +185,7 @@ class Doctrine_Data
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public static function exportData($directory, $format = 'yml', $models = array(), $exportIndividualFiles = false)
|
||||
public function exportData($directory, $format = 'yml', $models = array(), $exportIndividualFiles = false)
|
||||
{
|
||||
$export = new Doctrine_Data_Export($directory);
|
||||
$export->setFormat($format);
|
||||
@ -205,7 +205,7 @@ class Doctrine_Data
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public static function importData($directory, $format = 'yml', $models = array())
|
||||
public function importData($directory, $format = 'yml', $models = array())
|
||||
{
|
||||
$import = new Doctrine_Data_Import($directory);
|
||||
$import->setFormat($format);
|
||||
@ -223,7 +223,7 @@ class Doctrine_Data
|
||||
* @return void
|
||||
* @author Jonathan H. Wage
|
||||
*/
|
||||
public static function importDummyData($num = 3, $models = array())
|
||||
public function importDummyData($num = 3, $models = array())
|
||||
{
|
||||
$import = new Doctrine_Data_Import();
|
||||
$import->setModels($models);
|
||||
|
@ -8,10 +8,12 @@ You can export data to fixtures file in many different formats
|
||||
// A few ways exist for specifying where you export the data
|
||||
|
||||
// Dump to one large fixture file
|
||||
Doctrine_Data::exportData('data.yml', 'yml');
|
||||
$data = new Doctrine_Data();
|
||||
$data->exportData('data.yml', 'yml');
|
||||
|
||||
// Dump to individual files. One file per model. 3rd argument true specifies to dump to individual files
|
||||
Doctrine_Data::exportData('path/to/directory', 'yml', true);
|
||||
$data = new Doctrine_Data();
|
||||
$data->exportData('path/to/directory', 'yml', true);
|
||||
</code>
|
||||
|
||||
++ Importing
|
||||
@ -31,7 +33,8 @@ $format = 'csv';
|
||||
|
||||
$models = array('User', 'Phonenumber'); // you can optionally specify an array of the models you wish to import the data for, by default it loads data for all the available loaded models and the data that exists
|
||||
|
||||
Doctrine_Data::importData($path, $format, $models);
|
||||
$data = new Doctrine_Data();
|
||||
$data->importData($path, $format, $models);
|
||||
</code>
|
||||
|
||||
++ Dummy Data
|
||||
@ -42,7 +45,8 @@ With Doctrine Data you can import dummy data to all your Doctrine Records
|
||||
$numRecords = 3; // Number of dummy records to populate for each model
|
||||
$models = array('User', 'Email'); // Models to generate dummy data for. If none specified it generates dummy data for all loaded models.
|
||||
|
||||
Doctrine_Data::importDummyData($numRecords, $models);
|
||||
$data = new Doctrine_Data();
|
||||
$data->importDummyData($numRecords, $models);
|
||||
</code>
|
||||
|
||||
++ Writing
|
||||
@ -76,5 +80,6 @@ Phonenumber:
|
||||
Here is how you would write code to load the data from that data.yml file
|
||||
|
||||
<code type="php">
|
||||
Doctrine_Data::importData('data.yml', 'yml');
|
||||
$data = new Doctrine_Data();
|
||||
$data->importData('data.yml', 'yml');
|
||||
</code>
|
Loading…
x
Reference in New Issue
Block a user