Skip to content

Firefly III: a personal finances manager

Debug for #3897

James Cole0b8415e82b85
diff --git a/app/Factory/TransactionGroupFactory.php b/app/Factory/TransactionGroupFactory.php
index 4363edad84..146c7ac139 100644
--- a/app/Factory/TransactionGroupFactory.php
+++ b/app/Factory/TransactionGroupFactory.php
@@ -59,6 +59,7 @@ class TransactionGroupFactory
*/
public function create(array $data): TransactionGroup
{
+ Log::debug('Now in TransactionGroupFactory::create()');
$this->journalFactory->setUser($this->user);
$this->journalFactory->setErrorOnHash($data['error_if_duplicate_hash'] ?? false);
try {
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index 449d9b8718..c16c168920 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -134,6 +134,7 @@ class TransactionJournalFactory
*/
public function create(array $data): Collection
{
+ Log::debug('Now in TransactionJournalFactory::create()');
// convert to special object.
$dataObject = new NullArrayObject($data);
diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php
index 12cc232a61..62951ecccf 100644
--- a/app/Services/Internal/Support/JournalServiceTrait.php
+++ b/app/Services/Internal/Support/JournalServiceTrait.php
@@ -83,9 +83,9 @@ trait JournalServiceTrait
* @param string $direction
* @param array $data
*
- * @throws FireflyException
* @return Account
* @codeCoverageIgnore
+ * @throws FireflyException
*/
protected function getAccount(string $transactionType, string $direction, array $data): Account
{
@@ -184,7 +184,7 @@ trait JournalServiceTrait
*/
protected function storeNotes(TransactionJournal $journal, ?string $notes): void
{
- $notes = (string)$notes;
+ $notes = (string) $notes;
$note = $journal->notes()->first();
if ('' !== $notes) {
if (null === $note) {
@@ -219,14 +219,17 @@ trait JournalServiceTrait
*/
protected function storeTags(TransactionJournal $journal, ?array $tags): void
{
-
+ Log::debug('Now in storeTags()', $tags ?? []);
$this->tagFactory->setUser($journal->user);
$set = [];
if (!is_array($tags)) {
+ Log::debug('Tags is not an array, break.');
return;
}
+ Log::debug('Start of loop.');
foreach ($tags as $string) {
- $string = (string)$string;
+ $string = (string) $string;
+ Log::debug(sprintf('Now at tag "%s"', $string));
if ('' !== $string) {
$tag = $this->tagFactory->findOrCreate($string);
if (null !== $tag) {
@@ -234,7 +237,10 @@ trait JournalServiceTrait
}
}
}
+ Log::debug('End of loop.');
+ Log::debug(sprintf('Total nr. of tags: %d', count($tags)), $tags);
$journal->tags()->sync($set);
+ Log::debug('Done!');
}
/**
@@ -336,8 +342,8 @@ trait JournalServiceTrait
* @param array $data
* @param string $preferredType
*
- * @throws FireflyException
* @return Account
+ * @throws FireflyException
*/
private function createAccount(?Account $account, array $data, string $preferredType): Account
{