}
if ($request_id) {
- /** @var Introduction $Intro */
- $Intro = \Friendica\BaseObject::getClass(Introduction::class);
- $Intro->fetch(['id' => $request_id, 'uid' => local_user()]);
+ $Intro = DI::intro()->fetch(['id' => $request_id, 'uid' => local_user()]);
switch ($_POST['submit']) {
case L10n::t('Discard'):
*/
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;
}
/**
*/
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);
}
/**
* @method static Core\Session\ISession session()
* @method static Database\Database dba()
* @method static Model\Notify notify()
+ * @method static Model\Introduction intro()
* @method static Protocol\Activity activity()
* @method static Util\ACLFormatter aclFormatter()
* @method static Util\DateTimeFormat dtFormat()
'session' => Core\Session\ISession::class,
'dba' => Database\Database::class,
'notify' => Model\Notify::class,
+ 'intro' => Model\Introduction::class,
'activity' => Protocol\Activity::class,
'aclFormatter' => Util\ACLFormatter::class,
'dtFormat' => Util\DateTimeFormat::class,
{
parent::post($parameters);
- /** @var Introduction $Intro */
- $Intro = self::getClass(Introduction::class);
- $Intro->fetch(['id' => $parameters['id'], 'uid' => self::$current_user_id]);
+ $Intro = DI::intro()->fetch(['id' => $parameters['id'], 'uid' => self::$current_user_id]);
$contactId = $Intro->{'contact-id'};
$duplex = intval($_POST['duplex'] ?? 0);
$hidden = intval($_POST['hidden'] ?? 0);
- /** @var Introduction $Intro */
- $Intro = self::getClass(Introduction::class);
- $Intro->fetch(['id' => $intro_id, 'uid' => local_user()]);
+ $Intro = DI::intro()->fetch(['id' => $intro_id, 'uid' => local_user()]);
$cid = $Intro->{'contact-id'};