2014-08-06 00:16:10 +00:00
|
|
|
<?php
|
|
|
|
|
2022-11-02 20:47:04 +00:00
|
|
|
namespace MediaWiki\Extension\Notifications\Mapper;
|
|
|
|
|
|
|
|
use EchoTargetPage;
|
|
|
|
|
2014-08-06 00:16:10 +00:00
|
|
|
/**
|
|
|
|
* Database mapper for EchoTargetPage model
|
|
|
|
*/
|
2022-11-02 20:47:04 +00:00
|
|
|
class TargetPageMapper extends AbstractMapper {
|
2014-08-06 00:16:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* List of db fields used to construct an EchoTargetPage model
|
|
|
|
* @var string[]
|
|
|
|
*/
|
2016-12-05 18:51:07 +00:00
|
|
|
protected static $fields = [
|
2014-08-06 00:16:10 +00:00
|
|
|
'etp_page',
|
|
|
|
'etp_event'
|
2016-12-05 18:51:07 +00:00
|
|
|
];
|
2014-08-06 00:16:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert an EchoTargetPage instance into the database
|
|
|
|
*
|
|
|
|
* @param EchoTargetPage $targetPage
|
2017-07-26 19:34:44 +00:00
|
|
|
* @return bool
|
2014-08-06 00:16:10 +00:00
|
|
|
*/
|
|
|
|
public function insert( EchoTargetPage $targetPage ) {
|
2021-05-03 07:28:02 +00:00
|
|
|
$dbw = $this->dbFactory->getEchoDb( DB_PRIMARY );
|
2014-08-06 00:16:10 +00:00
|
|
|
|
|
|
|
$row = $targetPage->toDbArray();
|
|
|
|
|
2018-10-26 21:36:39 +00:00
|
|
|
$dbw->insert( 'echo_target_page', $row, __METHOD__ );
|
2014-08-06 00:16:10 +00:00
|
|
|
|
2018-10-26 21:36:39 +00:00
|
|
|
return true;
|
2014-08-06 00:16:10 +00:00
|
|
|
}
|
|
|
|
}
|