1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 05:20:56 +01:00

Conduit: differential.setdiffproperty

This commit is contained in:
epriestley 2011-01-24 12:07:34 -08:00
parent 2bea542920
commit 7779c67668
7 changed files with 116 additions and 3 deletions

View file

@ -50,6 +50,7 @@ phutil_register_library_map(array(
'ConduitAPIRequest' => 'applications/conduit/protocol/request',
'ConduitAPI_conduit_connect_Method' => 'applications/conduit/method/conduit/connect',
'ConduitAPI_differential_creatediff_Method' => 'applications/conduit/method/differential/creatediff',
'ConduitAPI_differential_setdiffproperty_Method' => 'applications/conduit/method/differential/setdiffproperty',
'ConduitAPI_file_upload_Method' => 'applications/conduit/method/file/upload',
'ConduitAPI_user_find_Method' => 'applications/conduit/method/user/find',
'ConduitException' => 'applications/conduit/protocol/exception',
@ -58,6 +59,7 @@ phutil_register_library_map(array(
'DifferentialChangeset' => 'applications/differential/storage/changeset',
'DifferentialDAO' => 'applications/differential/storage/base',
'DifferentialDiff' => 'applications/differential/storage/diff',
'DifferentialDiffProperty' => 'applications/differential/storage/diffproperty',
'DifferentialHunk' => 'applications/differential/storage/hunk',
'DifferentialLintStatus' => 'applications/differential/constants/lintstatus',
'DifferentialRevision' => 'applications/differential/storage/revision',
@ -154,11 +156,13 @@ phutil_register_library_map(array(
'AphrontWebpageResponse' => 'AphrontResponse',
'ConduitAPI_conduit_connect_Method' => 'ConduitAPIMethod',
'ConduitAPI_differential_creatediff_Method' => 'ConduitAPIMethod',
'ConduitAPI_differential_setdiffproperty_Method' => 'ConduitAPIMethod',
'ConduitAPI_file_upload_Method' => 'ConduitAPIMethod',
'ConduitAPI_user_find_Method' => 'ConduitAPIMethod',
'DifferentialChangeset' => 'DifferentialDAO',
'DifferentialDAO' => 'PhabricatorLiskDAO',
'DifferentialDiff' => 'DifferentialDAO',
'DifferentialDiffProperty' => 'DifferentialDAO',
'DifferentialHunk' => 'DifferentialDAO',
'DifferentialRevision' => 'DifferentialDAO',
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',

View file

@ -127,7 +127,7 @@ class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod {
return array(
'diffid' => $diff->getID(),
'uri' => '?'//$diff->getURI(),
'uri' => 'http://local.aphront.com/differential/diff/'.$diff->getID().'/',
);
}

View file

@ -0,0 +1,52 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class ConduitAPI_differential_setdiffproperty_Method extends ConduitAPIMethod {
public function getMethodDescription() {
return "Attach properties to Differential diffs.";
}
public function defineParamTypes() {
return array(
'diff_id' => 'required diff_id',
'name' => 'required string',
'data' => 'required string',
);
}
public function defineReturnType() {
return 'void';
}
public function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => 'Diff was not found.',
);
}
protected function execute(ConduitAPIRequest $request) {
$property = new DifferentialDiffProperty();
$property->setDiffID($request->getValue('diff_id'));
$property->setName($request->getValue('name'));
$property->setData($request->getValue('data'));
$property->save();
return;
}
}

View file

@ -0,0 +1,13 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/conduit/method/base');
phutil_require_module('phabricator', 'applications/differential/storage/diffproperty');
phutil_require_source('ConduitAPI_differential_setdiffproperty_Method.php');

View file

@ -60,8 +60,8 @@ class DifferentialDiff extends DifferentialDAO {
// $this->openTransaction();
$ret = parent::save();
foreach ($this->unsavedChangesets as $changeset) {
// $changeset->setDiffID($this->getID());
// $changeset->save();
$changeset->setDiffID($this->getID());
$changeset->save();
}
// $this->saveTransaction();
return $ret;

View file

@ -0,0 +1,32 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class DifferentialDiffProperty extends DifferentialDAO {
protected $diffID;
protected $name;
protected $data;
protected function getConfiguration() {
return array(
self::CONFIG_SERIALIZATION => array(
'data' => self::SERIALIZATION_JSON,
)) + parent::getConfiguration();
}
}

View file

@ -0,0 +1,12 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/differential/storage/base');
phutil_require_source('DifferentialDiffProperty.php');