本文整理汇总了PHP中TRepository::load方法的典型用法代码示例。如果您正苦于以下问题:PHP TRepository::load方法的具体用法?PHP TRepository::load怎么用?PHP TRepository::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRepository
的用法示例。
在下文中一共展示了TRepository::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_notes
/**
* Return the issue notes
*/
public function get_notes()
{
$repos = new TRepository('Note');
$criteria = new TCriteria();
$criteria->add(new TFilter('id_issue', '=', $this->id));
return $repos->load($criteria);
}
示例2: listForCategory
public static function listForCategory($category_id)
{
$criteria = new TCriteria();
$criteria->add(new TFilter('category_id', '=', $category_id));
$repos = new TRepository('Post');
return $repos->load($criteria);
}
示例3: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'samples'
TTransaction::open('samples');
// creates a repository for Category
$repository = new TRepository('Category');
// creates a criteria, ordered by id
$criteria = new TCriteria();
$order = isset($param['order']) ? $param['order'] : 'id';
$criteria->setProperty('order', $order);
// load the objects according to criteria
$categories = $repository->load($criteria);
$this->datagrid->clear();
if ($categories) {
// iterate the collection of active records
foreach ($categories as $category) {
// add the object inside the datagrid
$this->datagrid->addItem($category);
}
}
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例4: get_listOfMaterialConsumo
public function get_listOfMaterialConsumo()
{
$criteria = new TCriteria();
$criteria->add(new TFilter('tipo_material_consumo_id', '=', $this->id));
$repository = new TRepository('MaterialConsumo');
return $repository->load($criteria);
}
示例5: get_listOfMaterialPermanente
public function get_listOfMaterialPermanente()
{
$criteria = new TCriteria();
$criteria->add(new TFilter('tipo_material_permanente_id', '=', $this->id));
$repository = new TRepository('MaterialPermanente');
return $repository->load($criteria);
}
示例6: onReload
function onReload($param = NULL)
{
$offset = $param['offset'];
//$order = $param['order'];
$limit = 10;
// inicia transação com o banco 'pg_livro'
TTransaction::open('pg_livro');
// instancia um repositório para Alunos
$repository = new TRepository('Pessoa');
// retorna todos objetos que satisfazem o critério
$criteria = new TCriteria();
$count = $repository->count($criteria);
$criteria->setProperty('limit', $limit);
$criteria->setProperty('offset', $offset);
$pessoas = $repository->load($criteria);
$this->navbar->setPageSize($limit);
$this->navbar->setCurrentPage($param['page']);
$this->navbar->setTotalRecords($count);
$this->datagrid->clear();
if ($pessoas) {
foreach ($pessoas as $pessoa) {
// adiciona o objeto na DataGrid
$this->datagrid->addItem($pessoa);
}
}
// finaliza a transação
TTransaction::close();
$this->loaded = true;
}
示例7: __construct
/**
* Class Constructor
* @param $name widget's name
* @param $database database name
* @param $model model class name
* @param $key table field to be used as key in the combo
* @param $value table field to be listed in the combo
* @param $ordercolumn column to order the fields (optional)
* @param array $filter TFilter (optional) By Alexandre
* @param array $expresione TExpression (opcional) by Alexandre
*/
public function __construct($name, $database, $model, $key, $value, $ordercolumn = NULL, $filter = NULL, $expression = NULL)
{
new TSession();
// executes the parent class constructor
parent::__construct($name);
// carrega objetos do banco de dados
TTransaction::open($database);
// instancia um repositório de Estado
$repository = new TRepository($model);
$criteria = new TCriteria();
$criteria->setProperty('order', isset($ordercolumn) ? $ordercolumn : $key);
if ($filter) {
foreach ($filter as $fil) {
if ($expression) {
foreach ($expression as $ex) {
$criteria->add($fil, $ex);
}
} else {
$criteria->add($fil);
}
}
}
// carrega todos objetos
$collection = $repository->load($criteria);
// adiciona objetos na combo
if ($collection) {
$items = array();
foreach ($collection as $object) {
$items[$object->{$key}] = $object->{$value};
}
parent::addItems($items);
}
TTransaction::close();
}
示例8: load
/**
* Load the object and its aggregates
* @param $id object ID
*/
public function load($id)
{
// load the related Contact objects
$repository = new TRepository('Contact');
$criteria = new TCriteria();
$criteria->add(new TFilter('customer_id', '=', $id));
$this->contacts = $repository->load($criteria);
// load the object itself
return parent::load($id);
}
示例9: newFromLogin
/**
* Retorna uma instância de usuário a partir do login
* @param $login Login do usuário
*/
public static function newFromLogin($login)
{
$repos = new TRepository('User');
$criteria = new TCriteria();
$criteria->add(new TFilter('login', '=', $login));
$objects = $repos->load($criteria);
if (isset($objects[0])) {
return $objects[0];
}
}
示例10: newFromBarcode
/**
* Returns the Item from its barcode
*/
public static function newFromBarcode($barcode)
{
$rep = new TRepository('Item');
$criteria = new TCriteria();
$criteria->add(new TFilter('barcode', '=', $barcode));
$objects = $rep->load($criteria);
if ($objects) {
$item = $objects[0];
return $item;
}
}
示例11: TCriteria
function get_inscricoes()
{
// cria um critério de seleção
$criteria = new TCriteria();
// filtra por codigo do aluno
$criteria->add(new TFilter('ref_aluno', '=', $this->id));
// instancia repositório de Inscrições
$repository = new TRepository('Inscricao');
// retorna todas inscrições que satisfazem o critério
return $repository->load($criteria);
}
示例12: getTicketsSolicitante
public function getTicketsSolicitante($solicitante_id)
{
$criteria = new TCriteria();
$criteria->add(new TFilter('solicitante_id', '=', $solicitante_id));
$repository = new TRepository('Ticket');
$tickets = $repository->load($criteria);
$retorno[] = '0';
foreach ($tickets as $row) {
$retorno[] = $row->id;
}
return $retorno;
}
示例13: getFromBarcode
/**
* Get the last loan (not arrived) from a barcode
*/
public static function getFromBarcode($barcode)
{
$rep = new TRepository('Loan');
$criteria = new TCriteria();
$criteria->add(new TFilter('barcode', '=', $barcode));
$criteria->add(new TFilter('arrive_date', 'is', NULL));
$objects = $rep->load($criteria);
if ($objects) {
$loan = $objects[0];
return $loan;
}
}
示例14: getWeekEvents
/**
* Return the week events
* @return Event[]
*/
public static function getWeekEvents()
{
$first_week_day = self::getFirstWeekDay();
$last_week_day = self::getLastWeekDay();
// load objects
$repo = new TRepository('Event');
$criteria = new TCriteria();
$criteria->add(new TFilter('event_date', '>=', $first_week_day));
$criteria->add(new TFilter('event_date', '<=', $last_week_day));
$criteria->setProperty('order', 'event_date, start_hour');
return $repo->load($criteria);
}
示例15: get_itens
public function get_itens()
{
// instancia um repositório de Item
$repositorio = new TRepository('Item');
// define o critério de seleção
$criterio = new TCriteria();
$criterio->add(new TFilter('id_venda', '=', $this->id));
// carrega a coleção de itens
$this->itens = $repositorio->load($criterio);
// retorna os itens
return $this->itens;
}