Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 66 lines (40 sloc) 1.738 kb
c56e632 added copyright
luc-pascal Ceccaldi authored
1 Copyright (c) 2009, AF83, All rights reserved
2
74e390c Added #morm channel on irc.freenode.org
moa3 authored
3 You can ask for help and/or improvements or just say hi on the irc.freenode.org#morm channel
4
0ff58ea commit the README
luc-pascal Ceccaldi authored
5 Morm is an attempt to create a nice and as powerfull as possible PHP orm.
6
7 For now, Morm can handle:
8
9 * Simple Object -> Table mapping
10 * one to one relations
0850664 typo
luc-pascal Ceccaldi authored
11 * one to many relations
0ff58ea commit the README
luc-pascal Ceccaldi authored
12 * many to many relations (still in early alpha stage though)
13 * polymorphism
3757256 put a very simple beginners howto in the README
luc-pascal Ceccaldi authored
14 * STI
6a26864 @francois2metz Updated readme with sphinx
francois2metz authored
15 * FullText search with Sphinx (http://www.sphinxsearch.com/)
3757256 put a very simple beginners howto in the README
luc-pascal Ceccaldi authored
16
17 thanks to the new Mormulous file, you can now use Morm in a very simple manner.
18
19 all you have to do is:
20
21 edit Mormulous.php
22 The minimal config you can do is set the DB_NAME and DB_USER constants.
23 You can also set the other Constants to match your requirements.
24
25 Morm is now Usable.
26
27 Let's suppose you have a table named "post" in your database with a field called
28 "name".
29
30 You can walk through its content by simply doing
31
32 <?php
33
34 require_once('Mormulous.php');
35
36 $posts = new Mormons('post');
37 foreach($posts as $post)
38 {
39 echo $post->name."\n";
40 }
41
42 --------------------------------------------------------------
43
44 You'll see that Morm will automagically generate a Model file called "post.php" in the MODELS_PATH and use it.
45
46 As soon as this model has been generated once, you can edit it at your
47 conveniance.
48
49
aecf4ed added STI
luc-pascal Ceccaldi authored
50 Be careful if you have a field called "type" in your table.
51 Morm will try to use the STI and load a class named after the content of this
52 field. Eventhough Morm tries to guess things and be nice with you as much as
53 possible, in this case, if the model Morm is looking for does not exist, it will
54 fail.
55 If you want to avoid this behavior, just add
0ff58ea commit the README
luc-pascal Ceccaldi authored
56
aecf4ed added STI
luc-pascal Ceccaldi authored
57
58 protected $sti_field = NULL;
0ff58ea commit the README
luc-pascal Ceccaldi authored
59
aecf4ed added STI
luc-pascal Ceccaldi authored
60
61 in the corresponding model
62
63
64
65 Feel free to ask for improvements
Something went wrong with that request. Please try again.