Exemple #1
0
\t\t\t\t</Unique>
\t\t\t</Keys>
\t\t</Grid>
\t</Grids>
</trpr:TorporConfig>
XML;
// A number of different ways of accessing the Torpor singleton instance exist.
// Either through a number of statically declared methods, an instance of the
// class, or through the instance returned by the global Torpor() function (a
// function of the same name as the class which simply returns
// Torpor::getInstance() - this last one is useful in versions of PHP 5.3.0
// which do not support the __callStatic method that would allow us to call the
// magical function names without referencing an instance of any kind)
var_dump(Torpor::isInitialized());
var_dump(Torpor()->initialize($xmlConfig));
var_dump(Torpor::isInitialized());
// Create a grid instance in singleton context
$user = Torpor::getInstance()->newUser();
print_r($user->columnNames());
$user->setId(12345);
$user->setUserName('george');
try {
    $user->setPasswordHash('george');
} catch (TorporException $e) {
    print_r('Encountered exception: ' . $e->getMessage() . "\n");
}
$user->setPasswordHash('something other than george');
var_dump($user->getId());
var_dump($user->getUserName());
var_dump($user->getEmail());
var_dump($user->getPasswordHash());