Development

ref/DirFixtures (diff)

You must first sign up to be able to contribute.

Changes from Version 1 of ref/DirFixtures

Show
Ignore:
Author:
bshirley (IP: 206.231.146.2)
Timestamp:
01/19/09 22:18:57 (9 years ago)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ref/DirFixtures

    v0 v1  
     1= fixtures = 
     2 
     3Fixtures are data that's loaded into the model (and ultimately the database) to initialize the state of the project.  Some fixtures are to initialize the project itself.  Others are used to set up test cases. 
     4 
     5== Locations == 
     6 
     7{{{ 
     8/<projname>/data/fixtures 
     9/<projname>/test/fixtures 
     10}}} 
     11 
     12== Contents == 
     13 
     14Depending on whether you are using Propel or Doctrine, you may need to organize your fixtures differently.  They are Yaml versions of data.  They need to contain data appropriate for their model definitions.  The top level is the entity name, each level below that is a named instance.  Named instances can be references elsewhere via their name.  A subset of php can be used to pre-process these files, allowing you to populate large data sets. 
     15 
     16Propel (currently) requires the reference data to be defined before it's referenced.  So, file names beginning numerically is commonly seen. 
     17 
     18== Examples == 
     19 
     20data from a fixture file from from [http://www.symfony-project.org/jobeet/1_2/Doctrine/en/ Jobeet(Doctrine)]: 
     21 
     22{{{ 
     23JobeetJob: 
     24  job_sensio_labs: 
     25    JobeetCategory: programming 
     26    type:         full-time 
     27    company:      Sensio Labs 
     28    logo:         /uploads/jobs/sensio_labs.png 
     29    url:          http://www.sensiolabs.com/ 
     30    position:     Web Developer 
     31    location:     Paris, France 
     32    description:  | 
     33      You've already developed websites with symfony and you want to work 
     34      with Open-Source technologies. You have a minimum of 3 years 
     35      experience in web development with PHP or Java and you wish to 
     36      participate to development of Web 2.0 sites using the best 
     37      frameworks available. 
     38    how_to_apply: | 
     39      Send your resume to fabien.potencier [at] sensio.com 
     40    is_public:    true 
     41    is_activated: true 
     42    token:        job_sensio_labs 
     43    email:        job@example.com 
     44    expires_at:   '2008-12-25' 
     45}}} 
     46 
     47== References == 
     48 
     49