<?php
/**
- * @copyright Copyright (C) 2010-2023, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
$this->factory = $factory;
$this->postFactory = $postFactory;
- $this->ruleFactory = $postFactory;
+ $this->ruleFactory = $ruleFactory;
}
public function selectOneById(int $lastInsertId): \Friendica\Moderation\Entity\Report
return $this->_selectOne(['id' => $lastInsertId]);
}
- public function save(\Friendica\Moderation\Entity\Report $Report)
+ public function save(\Friendica\Moderation\Entity\Report $Report): \Friendica\Moderation\Entity\Report
{
$fields = [
'reporter-id' => $Report->reporterCid,
$this->db->insert('report-rule', ['rid' => $newReportId, 'line-id' => $rule->lineId, 'text' => $rule->text]);
}
- $Report = $this->selectOneById($this->db->lastInsertId());
+ $Report = $this->selectOneById($newReportId);
}
return $Report;
}
$reportPosts = new Collection\Report\Posts(array_map([$this->postFactory, 'createFromTableRow'], $this->db->selectToArray('report-post', ['uri-id', 'status'], ['rid' => $condition['id'] ?? 0])));
- $reportRules = new Collection\Report\Rules(array_map([$this->ruleFactory, 'createFromTableRow'], $this->db->selectToArray('report-rule', ['line-id', 'line-text'], ['rid' => $condition['id'] ?? 0])));
+ $reportRules = new Collection\Report\Rules(array_map([$this->ruleFactory, 'createFromTableRow'], $this->db->selectToArray('report-rule', ['line-id', 'text'], ['rid' => $condition['id'] ?? 0])));
return $this->factory->createFromTableRow($fields, $reportPosts, $reportRules);
}