🚑 Corrige le fichier exemple

This commit is contained in:
Clement Desmidt 2017-09-30 15:42:09 +02:00
parent 29ea8882fe
commit 26911d0f8d

View File

@ -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';
}