Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106079881
PhabricatorCalendarExportQueryKeyTransaction.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
Sat, Mar 22, 04:23
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Mar 24, 04:23 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
25059086
Attached To
rPH Phabricator
PhabricatorCalendarExportQueryKeyTransaction.php
View Options
<?php
final
class
PhabricatorCalendarExportQueryKeyTransaction
extends
PhabricatorCalendarExportTransactionType
{
const
TRANSACTIONTYPE
=
'calendar.export.querykey'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getQueryKey
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setQueryKey
(
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s changed the query for this export.'
,
$this
->
renderAuthor
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$actor
=
$this
->
getActor
();
$errors
=
array
();
foreach
(
$xactions
as
$xaction
)
{
$value
=
$xaction
->
getNewValue
();
$query
=
id
(
new
PhabricatorSavedQueryQuery
())
->
setViewer
(
$actor
)
->
withEngineClassNames
(
array
(
'PhabricatorCalendarEventSearchEngine'
))
->
withQueryKeys
(
array
(
$value
))
->
executeOne
();
if
(
$query
)
{
continue
;
}
$builtin
=
id
(
new
PhabricatorCalendarEventSearchEngine
())
->
setViewer
(
$actor
)
->
getBuiltinQueries
(
$actor
);
if
(
isset
(
$builtin
[
$value
]))
{
continue
;
}
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Query key "%s" does not identify a valid event query.'
,
$value
),
$xaction
);
}
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getQueryKey
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Calendar exports must have a query key.'
));
}
return
$errors
;
}
}
Event Timeline
Log In to Comment