Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
2fe7b95f
Commit
2fe7b95f
authored
Sep 20, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes static methods to be normal public methods.
parent
1e109070
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
Data.php
lib/Doctrine/Data.php
+3
-3
data-fixtures.txt
manual/new/docs/en/data-fixtures.txt
+10
-5
No files found.
lib/Doctrine/Data.php
View file @
2fe7b95f
...
...
@@ -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
);
...
...
manual/new/docs/en/data-fixtures.txt
View file @
2fe7b95f
...
...
@@ -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>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment