{Child Class}::staticGet()

{Child Class}::staticGet() – Simple Get (Select) request, abbreviated (autogenerated)

Synopsis

object {Child Class}::staticGet ( mixed $key or $value , mixed $value )

Описание

The static method is similar to the get request, however it does not require the initial instantiation of the class. staticGet() can optionally cache the results. (see the configuration section)

Note: This can only be used for tables with a single column primary key.

Parameter

  • string $key - column or value if only one parameter is given

  • mixed $value - value

Return value

object mixed - FALSE or the object

Throws

Possible PEAR_Error values
Error code Error message Meaning Solution
DB_DATAOBJECT_ERROR_NOCLASS "could not autoload $class"    
DB_DATAOBJECT_ERROR_NOCLASS "Error creating $newclass"    
DB_DATAOBJECT_ERROR_NODATA "No Data return from get $key $value"    

Замечание

This method must be called statically.

Пример

Simple fetch of data based on Primary Key or column and value

<?php
$person 
DataObjects_Person::staticGet(12);
print_r($person);

$person DataObjects_Person::staticGet('name''fred');
print_r($person);
?>
    Поддержать сайт на родительском проекте КГБ