Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97203670
ReleephBranchEditController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 3, 10:08
Size
2 KB
Mime Type
text/x-php
Expires
Sun, Jan 5, 10:08 (2 d)
Engine
blob
Format
Raw Data
Handle
23353641
Attached To
rPH Phabricator
ReleephBranchEditController.php
View Options
<?php
final
class
ReleephBranchEditController
extends
ReleephProjectController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$releeph_branch
=
$this
->
getReleephBranch
();
$symbolic_name
=
$request
->
getStr
(
'symbolicName'
,
$releeph_branch
->
getSymbolicName
());
$errors
=
array
();
if
(
$request
->
isFormPost
())
{
$existing_with_same_symbolic_name
=
id
(
new
ReleephBranch
())
->
loadOneWhere
(
'id != %d AND releephProjectID = %d AND symbolicName = %s'
,
$releeph_branch
->
getID
(),
$releeph_branch
->
getReleephProjectID
(),
$symbolic_name
);
$releeph_branch
->
openTransaction
();
$releeph_branch
->
setSymbolicName
(
$symbolic_name
);
if
(
$existing_with_same_symbolic_name
)
{
$existing_with_same_symbolic_name
->
setSymbolicName
(
null
)
->
save
();
}
$releeph_branch
->
save
();
$releeph_branch
->
saveTransaction
();
return
id
(
new
AphrontRedirectResponse
())
->
setURI
(
$releeph_branch
->
getURI
());
}
$phids
=
array
();
$phids
[]
=
$creator_phid
=
$releeph_branch
->
getCreatedByUserPHID
();
$phids
[]
=
$cut_commit_phid
=
$releeph_branch
->
getCutPointCommitPHID
();
$handles
=
id
(
new
PhabricatorHandleQuery
())
->
setViewer
(
$request
->
getUser
())
->
withPHIDs
(
$phids
)
->
execute
();
$form
=
id
(
new
AphrontFormView
())
->
setUser
(
$request
->
getUser
())
->
appendChild
(
id
(
new
AphrontFormStaticControl
())
->
setLabel
(
pht
(
'Branch Name'
))
->
setValue
(
$releeph_branch
->
getName
()))
->
appendChild
(
id
(
new
AphrontFormMarkupControl
())
->
setLabel
(
pht
(
'Cut Point'
))
->
setValue
(
$handles
[
$cut_commit_phid
]->
renderLink
()))
->
appendChild
(
id
(
new
AphrontFormMarkupControl
())
->
setLabel
(
pht
(
'Created By'
))
->
setValue
(
$handles
[
$creator_phid
]->
renderLink
()))
->
appendChild
(
id
(
new
AphrontFormTextControl
)
->
setLabel
(
pht
(
'Symbolic Name'
))
->
setName
(
'symbolicName'
)
->
setValue
(
$symbolic_name
)
->
setCaption
(
pht
(
'Mutable alternate name, for easy reference, '
.
'(e.g. "LATEST")'
)))
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
addCancelButton
(
$releeph_branch
->
getURI
())
->
setValue
(
pht
(
'Save'
)));
$error_view
=
null
;
if
(
$errors
)
{
$error_view
=
id
(
new
AphrontErrorView
())
->
setSeverity
(
AphrontErrorView
::
SEVERITY_ERROR
)
->
setErrors
(
$errors
)
->
setTitle
(
pht
(
'Errors'
));
}
$title
=
pht
(
'Edit Branch %s'
,
$releeph_branch
->
getDisplayNameWithDetail
());
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
pht
(
'Edit'
));
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$error_view
,
$form
,
),
array
(
'title'
=>
$title
,
'device'
=>
true
,
));
}
}
Event Timeline
Log In to Comment