当前位置: 首页>>代码示例>>PHP>>正文


PHP Transaction::setLogger方法代码示例

本文整理汇总了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();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:22,代码来源:record_update.php

示例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();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:20,代码来源:record_protect.php

示例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();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:25,代码来源:collection_delete.php

示例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();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:19,代码来源:record_get.php

示例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();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:26,代码来源:record_novo.php

示例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();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:21,代码来源:record_clone.php


注:本文中的Transaction::setLogger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。