mirror of
https://github.com/friendica/friendica
synced 2025-04-22 17:50:11 +00:00
Add Model\Introduction class to DI registry
This commit is contained in:
parent
2cb449a0d5
commit
df0c05d635
5 changed files with 10 additions and 15 deletions
|
@ -32,10 +32,11 @@ abstract class BaseModel
|
|||
*/
|
||||
private $data = [];
|
||||
|
||||
public function __construct(Database $dba, LoggerInterface $logger)
|
||||
public function __construct(Database $dba, LoggerInterface $logger, $data = [])
|
||||
{
|
||||
$this->dba = $dba;
|
||||
$this->logger = $logger;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,15 +72,13 @@ abstract class BaseModel
|
|||
*/
|
||||
public function fetch(array $condition)
|
||||
{
|
||||
$intro = $this->dba->selectFirst(static::$table_name, [], $condition);
|
||||
$data = $this->dba->selectFirst(static::$table_name, [], $condition);
|
||||
|
||||
if (!$intro) {
|
||||
if (!$data) {
|
||||
throw new HTTPException\NotFoundException(static::class . ' record not found.');
|
||||
}
|
||||
|
||||
$this->data = $intro;
|
||||
|
||||
return $this;
|
||||
return new static($this->dba, $this->logger, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue