Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F449286
PhabricatorCalendarExportQueryKeyTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 7:14 PM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
66768
Default Alt Text
PhabricatorCalendarExportQueryKeyTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment