@@ -7,20 +7,20 @@ The PHP Persistence API (`PPA`) is an Interface for PHP-Applications to access O
77
88***
99
10- ## [ v1.0.0 released!] ( https://github.com/sweiguny/PHP-Persistence-API/releases/tag/v1.0.0 )
10+ ### [ v1.0.0 released!] ( https://github.com/sweiguny/PHP-Persistence-API/releases/tag/v1.0.0 )
1111
1212***
1313
14- ** Features:**
15- - Easy to embed in your project
14+ #### Features:
15+ - [ Easy to embed in your project] ( https://github.com/sweiguny/PHP-Persistence-API/wiki/Embedding-PPA )
1616- Configure entities via [ annotations] ( https://github.com/sweiguny/PHP-Persistence-API/wiki/Annotations-&-Parameters ) (no xml!)
1717 - Relations
1818 - OneToOne
1919 - OneToMany
2020 - ManyToMany
2121- [ TypedQueries] ( https://github.com/sweiguny/PHP-Persistence-API/wiki/TypedQuery ) and PreparedQueries.
22- - Transactions
2322- CRUD
23+ - Transactions
2424- Good performance
2525 - Eager- & Lazy-loading
2626- A neat [ WIKI] ( https://github.com/sweiguny/PHP-Persistence-API/wiki )
@@ -30,52 +30,41 @@ The PHP Persistence API (`PPA`) is an Interface for PHP-Applications to access O
3030
3131***
3232
33- ## Examples:
33+ ### Examples:
3434
3535** Configuring your entities:**
3636
37+ namespace PPA\examples\entity;
3738 use PPA\core\Entity;
3839
3940 /**
40- * @table(name="user ")
41+ * @table(name="role ")
4142 */
42- class User extends Entity {
43+ class Role extends Entity {
4344
4445 /**
4546 * @id
4647 * @column(name="id")
4748 */
4849 private $id;
4950
50- /**
51- * @Column(name="username")
52- */
53- private $username;
54-
55- /**
56- * @Column(name="password")
57- */
58- private $password;
51+ /** @column(name="name") */
52+ private $name;
5953
6054 /**
61- * @Column(name="role_id");
62- * @oneToOne(fetch="lazy ", mappedBy = "_PPA_examples_entity_Role ")
55+ * @manyToMany(fetch = "eager", mappedBy = "_PPA_examples_entity_Right")
56+ * @joinTable(name = "role2right ", column = "role_id", x_column = "right_id ")
6357 */
64- private $role;
65-
66- public function getRole() {
67- return $this->role;
68- }
58+ private $rights = array();
6959 }
7060
7161***
7262
7363** Retrieving data:**
7464
75- use PPA\core\query\TypedQuery;
76-
77- // A TypedQuery can automatically resolve all the relations and give an appropriate output.
78- $query = new TypedQuery("SELECT * FROM `role` WHERE id = 2", "\\PPA\\examples\\entity\\Role");
65+ A TypedQuery can automatically resolve all the relations and give an appropriate output.
66+
67+ $query = new \PPA\core\query\TypedQuery("SELECT * FROM `role` WHERE id = 2", "\\PPA\\examples\\entity\\Role");
7968 $query->getSingleResult();
8069
8170 Returns:
@@ -95,24 +84,5 @@ The PHP Persistence API (`PPA`) is an Interface for PHP-Applications to access O
9584 [id:PPA\examples\entity\Right:private] => 1
9685 [desc:PPA\examples\entity\Right:private] => login
9786 )
98- [2] => PPA\examples\entity\Right Object
99- (
100- [id:PPA\examples\entity\Right:private] => 2
101- [desc:PPA\examples\entity\Right:private] => logout
102- )
103- [3] => PPA\examples\entity\Right Object
104- (
105- [id:PPA\examples\entity\Right:private] => 5
106- [desc:PPA\examples\entity\Right:private] => create_order
107- )
108- [4] => PPA\examples\entity\Right Object
109- (
110- [id:PPA\examples\entity\Right:private] => 4
111- [desc:PPA\examples\entity\Right:private] => delete_order
112- )
11387 )
11488 )
115-
116- ***
117-
118- For more examples, please see the [ WIKI] ( https://github.com/sweiguny/PHP-Persistence-API/wiki ) .
0 commit comments