mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-16 00:38:38 +01:00
Summary: These are currently useless and confusing (they have no application impact), and should be migrated to edges if we want to restore them in some form. I left the actual storage so this doesn't destroy any data, it just removes all traces of this feature from the UI. Test Plan: Looked at and edited projects. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D3183
91 lines
2.6 KiB
PHP
91 lines
2.6 KiB
PHP
<?php
|
|
|
|
/*
|
|
* Copyright 2012 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.
|
|
*/
|
|
|
|
final class PhabricatorProject extends PhabricatorProjectDAO {
|
|
|
|
protected $name;
|
|
protected $phid;
|
|
protected $status = PhabricatorProjectStatus::STATUS_ACTIVE;
|
|
protected $authorPHID;
|
|
protected $subprojectPHIDs = array();
|
|
protected $phrictionSlug;
|
|
|
|
private $affiliations;
|
|
|
|
public function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_AUX_PHID => true,
|
|
self::CONFIG_SERIALIZATION => array(
|
|
'subprojectPHIDs' => self::SERIALIZATION_JSON,
|
|
),
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public function generatePHID() {
|
|
return PhabricatorPHID::generateNewPHID(
|
|
PhabricatorPHIDConstants::PHID_TYPE_PROJ);
|
|
}
|
|
|
|
public function loadProfile() {
|
|
$profile = id(new PhabricatorProjectProfile())->loadOneWhere(
|
|
'projectPHID = %s',
|
|
$this->getPHID());
|
|
return $profile;
|
|
}
|
|
|
|
public function getMemberPHIDs() {
|
|
return mpull($this->getAffiliations(), 'getUserPHID');
|
|
}
|
|
|
|
public function loadMemberPHIDs() {
|
|
return mpull($this->loadAffiliations(), 'getUserPHID');
|
|
}
|
|
|
|
public function getAffiliations() {
|
|
if ($this->affiliations === null) {
|
|
throw new Exception('Attach affiliations first!');
|
|
}
|
|
return $this->affiliations;
|
|
}
|
|
|
|
public function attachAffiliations(array $affiliations) {
|
|
assert_instances_of($affiliations, 'PhabricatorProjectAffiliation');
|
|
$this->affiliations = $affiliations;
|
|
return $this;
|
|
}
|
|
|
|
public function loadAffiliations() {
|
|
$affils = PhabricatorProjectAffiliation::loadAllForProjectPHIDs(
|
|
array($this->getPHID()));
|
|
return $affils[$this->getPHID()];
|
|
}
|
|
|
|
public function setPhrictionSlug($slug) {
|
|
|
|
// NOTE: We're doing a little magic here and stripping out '/' so that
|
|
// project pages always appear at top level under projects/ even if the
|
|
// display name is "Hack / Slash" or similar (it will become
|
|
// 'hack_slash' instead of 'hack/slash').
|
|
|
|
$slug = str_replace('/', ' ', $slug);
|
|
$slug = PhabricatorSlug::normalize($slug);
|
|
$this->phrictionSlug = $slug;
|
|
return $this;
|
|
}
|
|
|
|
}
|