PersistenceObjects for php

6. Use the PersistenceObjects in your controllers

This last step is up to you. You can start using the PersistenceObjects. Basic CRUD operations can be performed as follows:

Create

$user = new User();
$user->setUserName("luuseri");
$up = new UserPersistence($user);
$up->persist();

Read one object

$up = new UserPersistence($userId);
$user = $up->getValueObject();

Read all objects

$up = new UserPersistence();
$userList = $up->getAll();

Update

$up = new UserPersistence($user);
$up->merge();

Delete

$up = new UserPersistence($user);
$up->delete();

As you can see although the configuration might be annoying at first, the usage is heavenly.

previous - Configure DatabaseManager and create the database
next - Add database-methods