Really useful software project management and source code hosting.    tell me more...
BROWSE: projects / users / groups
  GROUP


Really Useful Social coding!

Codaset is an open system, so you can browse and search through all the open source projects, and check out what your friends are coding. Follow them, befriend them, and fork their code; quickly and easily.
Every single open source project you create is free, so come on and use Codaset at no cost. Your first private or semi-private project is also free. Read more about what it costs after that.

Using Fixtures

Fixtures are used to easily insert values into your database. The most common use for a fixture is to insert example record into your database

You fixtures the same way you run migrate:

cake fixtures help

If you wanted to create a fixture for your users table, it would be in the file @app/config/fixtures/users.php@ and it would look like this:

<pre><code>---

user:

id: 1
name: My user!!
description: foo bar
created: 2008-11-13 21:03:40
modified: 2008-11-13 21:03:40
  • contests: id: 2 name: Lorem description: Lorem ipsum dolor sit amet, consectetur created: 2008-11-13 21:21:39 modified: 2008-11-13 21:21:39</code></pre>

If you have to reset your database or need to reinsert data for any reason, you can "dump" all your current data to fixtures like so:

cake fixtures g fromdb -force

(The -force option overwrites any existing files in @app/config/fixtures@)

Then you can load them back into the database simply by calling:

cake fixtures

Attachments

No attachments found




Browse our wiki...




« previous version |
created about 1 year ago by Joel Moss |
| next version »