2014-08-06 00:16:10 +00:00
|
|
|
<?php
|
|
|
|
|
2022-11-02 20:47:04 +00:00
|
|
|
namespace MediaWiki\Extension\Notifications\Mapper;
|
|
|
|
|
2022-11-02 21:34:17 +00:00
|
|
|
use MediaWiki\Extension\Notifications\Model\TargetPage;
|
2022-11-02 20:47:04 +00:00
|
|
|
|
2014-08-06 00:16:10 +00:00
|
|
|
/**
|
2022-11-02 21:34:17 +00:00
|
|
|
* Database mapper for TargetPage model
|
2014-08-06 00:16:10 +00:00
|
|
|
*/
|
2022-11-02 20:47:04 +00:00
|
|
|
class TargetPageMapper extends AbstractMapper {
|
2014-08-06 00:16:10 +00:00
|
|
|
|
|
|
|
/**
|
2022-11-02 21:34:17 +00:00
|
|
|
* List of db fields used to construct an TargetPage model
|
2014-08-06 00:16:10 +00:00
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
2022-11-02 21:34:17 +00:00
|
|
|
* Insert an TargetPage instance into the database
|
2014-08-06 00:16:10 +00:00
|
|
|
*
|
2022-11-02 21:34:17 +00:00
|
|
|
* @param TargetPage $targetPage
|
2017-07-26 19:34:44 +00:00
|
|
|
* @return bool
|
2014-08-06 00:16:10 +00:00
|
|
|
*/
|
2022-11-02 21:34:17 +00:00
|
|
|
public function insert( TargetPage $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();
|
|
|
|
|
2024-04-13 18:33:56 +00:00
|
|
|
$dbw->newInsertQueryBuilder()
|
|
|
|
->insertInto( 'echo_target_page' )
|
|
|
|
->row( $row )
|
|
|
|
->caller( __METHOD__ )
|
|
|
|
->execute();
|
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
|
|
|
}
|
|
|
|
}
|