From 26911d0f8d3748962c6874683b987198ef51a7ec Mon Sep 17 00:00:00 2001 From: Clement Desmidt Date: Sat, 30 Sep 2017 15:42:09 +0200 Subject: [PATCH] :ambulance: Corrige le fichier exemple --- lbcreposter.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lbcreposter.php b/lbcreposter.php index a2074c7..4d34790 100644 --- a/lbcreposter.php +++ b/lbcreposter.php @@ -4,20 +4,24 @@ include 'vendor/autoload.php'; define('APP_DIR', dirname(__FILE__)); define('DEALS_DIR', sprintf('%s/deals', APP_DIR)); -$script_params = parse_ini_file(sprintf('%s/lbcreposter.ini.dev', DEALS_DIR), true); +$script_params = parse_ini_file(sprintf('%s/lbcreposter.ini', DEALS_DIR), true); $config = new \Shikiryu\LBCReposter\Config($script_params); -$account = new \Shikiryu\LBCReposter\Account($client, $config); -$deal = \Shikiryu\LBCReposter\Deal::fromJSON(sprintf('%s/deals/tmp/data.json', APP_DIR)); +$account = new \Shikiryu\LBCReposter\Account($config); +$actions = new \Shikiryu\LBCReposter\Actions($account); +//$deal = \Shikiryu\LBCReposter\Deal::fromJSON(sprintf('%s/deals/tmp/data.json', APP_DIR)); -if ($account->connect()) { +if ($actions->connect()) { // existing deals - $deals = $account->getDeals(); + $deals = $actions->retrieve(); + /** @var \Shikiryu\LBCReposter\Deal $deal */ - foreach ($deals as $deal) { + foreach ($deals as $i => $deal) { $deal->save(DEALS_DIR); } - $account->addDeal($deal); +// $account->addDeal($deal); var_dump($deals); +} else { + echo 'not connected'; }