mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Lots of new code for new importer routine.
This commit is contained in:
25
app/Import/Object/ImportAccount.php
Normal file
25
app/Import/Object/ImportAccount.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* ImportAccount.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Import\Object;
|
||||
|
||||
|
||||
class ImportAccount
|
||||
{
|
||||
|
||||
/** @var array */
|
||||
private $accountIds = [];
|
||||
|
||||
public function setAccountId(string $value)
|
||||
{
|
||||
$this->accountIds[] = $value;
|
||||
}
|
||||
}
|
74
app/Import/Object/ImportObject.php
Normal file
74
app/Import/Object/ImportObject.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* ImportObject.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Import\Object;
|
||||
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ImportObject
|
||||
{
|
||||
/** @var Collection */
|
||||
public $errors;
|
||||
/** @var ImportAccount */
|
||||
private $asset;
|
||||
/** @var string */
|
||||
private $hash;
|
||||
/** @var ImportAccount */
|
||||
private $opposing;
|
||||
/** @var ImportTransaction */
|
||||
private $transaction;
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* ImportEntry constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->errors = new Collection;
|
||||
$this->transaction = new ImportTransaction;
|
||||
$this->asset = new ImportAccount;
|
||||
$this->opposing = new ImportAccount;
|
||||
}
|
||||
|
||||
public function setHash(string $hash)
|
||||
{
|
||||
$this->hash = $hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
*/
|
||||
public function setValue(array $array)
|
||||
{
|
||||
switch ($array['role']) {
|
||||
default:
|
||||
throw new FireflyException(sprintf('ImportObject cannot handle "%s" with value "%s".', $array['role'], $array['value']));
|
||||
case 'account-id':
|
||||
$this->asset->setAccountId($array['value']);
|
||||
break;
|
||||
}
|
||||
//var_dump($array);
|
||||
//exit;
|
||||
}
|
||||
|
||||
}
|
18
app/Import/Object/ImportTransaction.php
Normal file
18
app/Import/Object/ImportTransaction.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* ImportTransaction.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Import\Object;
|
||||
|
||||
|
||||
class ImportTransaction
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user