}
/**
- * Gets called after successfull removal.
- * Can be overriden to get rid of linked data.
+ * Gets called after successful removal.
+ * Can be overridden to get rid of linked data.
*
* @since 1.20
*/
}
/**
- * @see ORMRow::save
+ * @see IORMRow::save
* @see Site::save
*
* @since 1.21
* @return boolean Success indicator
*/
public function save( $functionName = null ) {
- $dbw = wfGetDB( DB_MASTER );
+ $dbw = $this->table->getWriteDbConnection();
$trx = $dbw->trxLevel();
return $success;
}
+ /**
+ * @since 1.21
+ *
+ * @see ORMRow::onRemoved
+ */
+ protected function onRemoved() {
+ $dbw = $this->table->getWriteDbConnection();
+
+ $dbw->delete(
+ 'site_identifiers',
+ array(
+ 'si_site' => $this->getId()
+ ),
+ __METHOD__
+ );
+
+ parent::onRemoved();
+ }
+
/**
* @see Site::setPath
*
/**
* @dataProvider constructorTestProvider
*/
- public function testSave( array $data, $loadDefaults ) {
+ public function testSaveAndRemove( array $data, $loadDefaults ) {
$item = $this->getRowInstance( $data, $loadDefaults );
$this->assertTrue( $item->save() );
$this->assertEquals( $id, $item->getId() );
$this->verifyFields( $item, $data );
- }
-
- /**
- * @dataProvider constructorTestProvider
- * @depends testSave
- */
- public function testRemove( array $data, $loadDefaults ) {
- $item = $this->getRowInstance( $data, $loadDefaults );
$this->assertTrue( $item->remove() );