| 3 | | |
| 4 | | <div id="download_links> |
| 5 | | <?php echo get_partial('download'); ?> |
| 6 | | <ul> |
| 7 | | <li>svn co <?php echo link_to('http://svn.phpdoctrine.org/trunk', 'http://svn.phpdoctrine.org/trunk'); ?> .</li> |
| 8 | | </ul> |
| | 3 | |
| | 4 | <div id="download_links"> |
| | 5 | <?php foreach ($releases as $release): ?> |
| | 6 | <h2> |
| | 7 | Doctrine <?php echo $release->getName(); ?> |
| | 8 | <?php if ($release->getLatest()): ?> |
| | 9 | (latest) |
| | 10 | <?php endif; ?> |
| | 11 | </h2> |
| | 12 | |
| | 13 | <ul style="margin-left: 30px; list-style: square;"> |
| | 14 | <li>svn co <?php echo link_to($release->getSvnUrl(), $release->getSvnUrl()); ?> .</li> |
| | 15 | <li><?php echo link_to($release->getPackageFileName(), $release->getPackageRoute()); ?></li> |
| | 16 | </ul> |
| | 17 | <?php endforeach; ?> |
| | 41 | |
| | 42 | <h2>Get started with Sandbox</h2> |
| | 43 | |
| | 44 | <p>The sandbox is a sample implementation of the Doctrine ORM framework in a ready to use web application setup. |
| | 45 | It uses a sqlite database that is ready to use out-of-the-box.</p> |
| | 46 | |
| | 47 | <pre><code> |
| | 48 | // Checkout from svn |
| | 49 | $ svn co http://svn.phpdoctrine.org/trunk doctrine |
| | 50 | |
| | 51 | // Move in to the sandbox directory |
| | 52 | $ cd doctrine/tools/sandbox |
| | 53 | |
| | 54 | // Write your schema files |
| | 55 | $ vi schema/user.yml |
| | 56 | |
| | 57 | // Sample user schema file |
| | 58 | --- |
| | 59 | User: |
| | 60 | columns: |
| | 61 | username: string(255) |
| | 62 | password: string(255) |
| | 63 | |
| | 64 | $ vi data/fixtures/data.yml |
| | 65 | |
| | 66 | // Sample user data fixtures |
| | 67 | --- |
| | 68 | User: |
| | 69 | jwage: |
| | 70 | username: jwage |
| | 71 | password: changeme |
| | 72 | zYne-: |
| | 73 | username: zYne- |
| | 74 | password: changeme |
| | 75 | |
| | 76 | // Build everything. Will drop databases(if they exist), generate models, |
| | 77 | // create databases, create all tables, and load all fixtures data |
| | 78 | |
| | 79 | $ ./doctrine build-all-reload |
| | 80 | |
| | 81 | // Will generate models in doctrine/tools/sandbox/models |
| | 82 | // Take a peak at doctrine/tools/sandbox/models/generated/BaseUser.class.php to see the generated class. |
| | 83 | // You can modify doctrine/tools/sandbox/models/User.class.php to add your own custom php code to the model |
| | 84 | // Start using your models |
| | 85 | |
| | 86 | $ vi index.php |
| | 87 | |
| | 88 | require_once('config.php'); |
| | 89 | |
| | 90 | $user = Doctrine::getTable('User')->findOneByUsername('jwage'); |
| | 91 | echo $user->username; // prints jwage |
| | 92 | |
| | 93 | // Query your models with DQL from the command line |
| | 94 | |
| | 95 | $ ./doctrine dql "FROM User u WHERE u.username = ?" jwage |
| | 96 | </code></pre> |