First working version of a working Spectre import.

This commit is contained in:
James Cole
2018-05-19 21:13:00 +02:00
parent 04953b5645
commit 2c206bba64
17 changed files with 552 additions and 172 deletions

View File

@@ -38,6 +38,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class Account.
*
* @property int $id
* @property string $name
* @property string $iban
*/

View File

@@ -22,7 +22,6 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -30,8 +29,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class ImportJob.
*
* @property array $configuration
* @property User $user
* @property array $transactions
* @property array $configuration
* @property User $user
* @property int $user_id
* @property string $status
* @property string $stage
*/
class ImportJob extends Model
{
@@ -53,22 +56,12 @@ class ImportJob extends Model
/** @var array */
protected $fillable = ['key', 'user_id', 'file_type', 'provider', 'status', 'stage', 'configuration', 'extended_status', 'transactions', 'errors'];
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function attachments()
{
return $this->morphMany(Attachment::class, 'attachable');
}
/**
* @param $value
*
* @return mixed
*
* @throws NotFoundHttpException
* @throws FireflyException
*/
public static function routeBinder(string $value): ImportJob
{
@@ -84,11 +77,11 @@ class ImportJob extends Model
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function user()
public function attachments()
{
return $this->belongsTo(User::class);
return $this->morphMany(Attachment::class, 'attachable');
}
/**
@@ -99,4 +92,13 @@ class ImportJob extends Model
{
return $this->belongsTo(Tag::class);
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class);
}
}