Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kaz29/FileFixture

FileFixture Plugin for CakePHP2.x
https://github.com/kaz29/FileFixture

Last synced: 3 months ago
JSON representation

FileFixture Plugin for CakePHP2.x

Awesome Lists containing this project

README

        

# FileFixture Plugin for CakePHP2.x

[![Build Status](https://travis-ci.org/kaz29/FileFixture.png)](https://travis-ci.org/kaz29/FileFixture)

## Feature

- Load fixture data from csv(Comma-Separated Values)/tsv(TAB-Separated Values) file
- Load master data from csv(Comma-Separated Values)/tsv(TAB-Separated Values) file

## Requirements

- PHP >= 5.3.x
- CakePHP >= 2.0

## Installation

Put 'FileFixture' directory on app/Plugin or plugins in your CakePHP application.
Then, add the following code in bootstrap.php

array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 11, 'key' => 'primary'),
'title' => array('type' => 'string', 'null' => true, 'length' => 50),
'body' => array('type' => 'text', 'null' => true, 'length' => 1073741824),
'created' => array('type' => 'datetime', 'null' => true),
'modified' => array('type' => 'datetime', 'null' => true),
'indexes' => array(
'PRIMARY' => array('unique' => true, 'column' => 'id')
),
'tableParameters' => array()
);

public $importRecords = array(
// 'path' => [path to Fixture File Path], // Optional(default is 'app/Test/Fixture/Data/')
'file' => 'posts.csv',
);
}

app/Test/Fixture/Data/posts.csv
title,body,created,modified
"The title","This is the post body.","2011-06-20 23:10:57","2011-06-20 23:10:57"
"A title once again","And the post body follows.","2011-06-20 23:10:57","2011-06-20 23:10:57"
"Title strikes back","This is really exciting! Not.","2011-06-20 23:10:57","2011-06-20 23:10:57"

### FileImporter