2011-02-06 01:57:21 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-13 19:18:11 +01:00
|
|
|
final class PhabricatorDraft extends PhabricatorDraftDAO {
|
2011-02-06 01:57:21 +01:00
|
|
|
|
|
|
|
protected $authorPHID;
|
|
|
|
protected $draftKey;
|
|
|
|
protected $draft;
|
2012-09-20 23:11:11 +02:00
|
|
|
protected $metadata = array();
|
|
|
|
|
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'metadata' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
2011-02-06 01:57:21 +01:00
|
|
|
|
2012-10-02 00:50:47 +02:00
|
|
|
public function replaceOrDelete() {
|
|
|
|
if ($this->draft == '' && !array_filter($this->metadata)) {
|
|
|
|
queryfx(
|
|
|
|
$this->establishConnection('w'),
|
|
|
|
'DELETE FROM %T WHERE authorPHID = %s AND draftKey = %s',
|
|
|
|
$this->getTableName(),
|
|
|
|
$this->authorPHID,
|
|
|
|
$this->draftKey);
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
return parent::replace();
|
|
|
|
}
|
|
|
|
|
2011-02-06 01:57:21 +01:00
|
|
|
}
|