Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2890984
AlmanacQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
AlmanacQuery.php
View Options
<?php
abstract
class
AlmanacQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$needProperties
;
public
function
needProperties
(
$need_properties
)
{
$this
->
needProperties
=
$need_properties
;
return
$this
;
}
protected
function
getNeedProperties
(
)
{
return
$this
->
needProperties
;
}
protected
function
didFilterPage
(
array
$objects
)
{
$has_properties
=
(
head
(
$objects
)
instanceof
AlmanacPropertyInterface
)
;
if
(
$has_properties
&&
$this
->
needProperties
)
{
$property_query
=
id
(
new
AlmanacPropertyQuery
(
)
)
->
setViewer
(
$this
->
getViewer
(
)
)
->
setParentQuery
(
$this
)
->
withObjects
(
$objects
)
;
$properties
=
$property_query
->
execute
(
)
;
$properties
=
mgroup
(
$properties
,
'getObjectPHID'
)
;
foreach
(
$objects
as
$object
)
{
$object_properties
=
idx
(
$properties
,
$object
->
getPHID
(
)
,
array
(
)
)
;
$object_properties
=
mpull
(
$object_properties
,
null
,
'getFieldName'
)
;
// Create synthetic properties for defaults on the object itself.
$specs
=
$object
->
getAlmanacPropertyFieldSpecifications
(
)
;
foreach
(
$specs
as
$key
=>
$spec
)
{
if
(
empty
(
$object_properties
[
$key
]
)
)
{
$default_value
=
$spec
->
getValueForTransaction
(
)
;
$object_properties
[
$key
]
=
id
(
new
AlmanacProperty
(
)
)
->
setObjectPHID
(
$object
->
getPHID
(
)
)
->
setFieldName
(
$key
)
->
setFieldValue
(
$default_value
)
;
}
}
foreach
(
$object_properties
as
$property
)
{
$property
->
attachObject
(
$object
)
;
}
$object
->
attachAlmanacProperties
(
$object_properties
)
;
}
}
return
$objects
;
}
public
function
getQueryApplicationClass
(
)
{
return
PhabricatorAlmanacApplication
::
class
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 14:25 (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125490
Default Alt Text
AlmanacQuery.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment