本文整理汇总了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();
}