本文整理匯總了PHP中Transaction::setLogger方法的典型用法代碼示例。如果您正苦於以下問題:PHP Transaction::setLogger方法的具體用法?PHP Transaction::setLogger怎麽用?PHP Transaction::setLogger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Transaction
的用法示例。
在下文中一共展示了Transaction::setLogger方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: LoggerTXT
<?php
require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
Transaction::open('estoque');
Transaction::setLogger(new LoggerTXT('tmp/log_update.txt'));
Transaction::log('Alterando um produto');
$p1 = Produto::find(2);
print $p1->estoque . "<br>\n";
$p1->estoque += 10;
print $p1->estoque . "<br>\n";
$p1->store();
Transaction::close();
} catch (Exception $e) {
Transaction::rollback();
print $e->getMessage();
}
示例2: LoggerTXT
<?php
require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
Transaction::open('estoque');
Transaction::setLogger(new LoggerTXT('tmp/log_protect.txt'));
Transaction::log('Protegendo o acesso a um produto');
$p1 = Produto::find(2);
$p1->estoque = 'dois';
$p1->store();
Transaction::close();
} catch (Exception $e) {
Transaction::rollback();
print $e->getMessage();
}
示例3: LoggerTXT
<?php
require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Expression.php';
require_once 'classes/api/Criteria.php';
require_once 'classes/api/Repository.php';
require_once 'classes/api/Record.php';
require_once 'classes/api/Filter.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/model/Produto.php';
try {
Transaction::open('estoque');
Transaction::setLogger(new LoggerTXT('tmp/log_collection_delete.txt'));
$criteria = new Criteria();
$criteria->add(new Filter('descricao', 'like', '%WEBC%'), Expression::OR_OPERATOR);
$criteria->add(new Filter('descricao', 'like', '%FILMAD%'), Expression::OR_OPERATOR);
$repository = new Repository('Produto');
$repository->delete($criteria);
Transaction::close();
} catch (Exception $e) {
echo $e->getMessage();
Transaction::rollback();
}
示例4: LoggerTXT
<?php
require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
Transaction::open('estoque');
Transaction::setLogger(new LoggerTXT('tmp/log_find.txt'));
Transaction::log('Buscando um produto');
$p1 = Produto::find(2);
print $p1->descricao;
Transaction::close();
} catch (Exception $e) {
Transaction::rollback();
print $e->getMessage();
}
示例5: LoggerTXT
<?php
require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
Transaction::open('estoque');
Transaction::setLogger(new LoggerTXT('tmp/log_novo.txt'));
Transaction::log('Inserindo produto novo');
$p1 = new Produto();
$p1->descricao = 'Cerveja artesanal IPA';
$p1->estoque = 50;
$p1->preco_custo = 8;
$p1->preco_venda = 12;
$p1->codigo_barras = '75363453234234';
$p1->data_cadastro = date('Y-m-d');
$p1->origem = 'N';
$p1->store();
Transaction::close();
} catch (Exception $e) {
Transaction::rollback();
print $e->getMessage();
}
示例6: LoggerTXT
<?php
require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
Transaction::open('estoque');
Transaction::setLogger(new LoggerTXT('tmp/log_clone.txt'));
Transaction::log('Clonando um produto');
$p1 = Produto::find(2);
$p2 = clone $p1;
$p2->descricao .= ' (clonado)';
$p2->store();
Transaction::close();
} catch (Exception $e) {
Transaction::rollback();
print $e->getMessage();
}