Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56321142
CollectionDocument.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
CollectionDocument.php
View Options
<?php
/**
* _, __, _, _ __, _ _, _, _
* / \ |_) (_ | | \ | /_\ |\ |
* \ / |_) , ) | |_/ | | | | \|
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
*
* Collection document class
*
* @package ObsidianWorkspaces
* @subpackage Collection
* @author Sébastien Santoro aka Dereckson <dereckson@espace-win.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @filesource
*/
namespace
Waystone\Workspaces\Engines\Collection
;
use
Waystone\Workspaces\Engines\Serialization\ObjectDeserializable
;
use
JsonSerializable
;
/**
* Collection document class
*
* This class represents a document, inside a collection.
*/
class
CollectionDocument
implements
JsonSerializable
,
ObjectDeserializable
{
/**
* @var string The document identifier
*/
public
$id
=
''
;
/**
* Specifies data which should be serialized to JSON
*/
public
function
jsonSerialize
()
:
static
{
return
$this
;
}
/**
* Loads a CollectionDocument instance from a generic object.
*
* @param object $data The object to deserialize
*
* @return self The deserialized instance
*/
public
static
function
loadFromObject
(
object
$data
)
:
static
{
$instance
=
new
static
;
foreach
(
$data
as
$key
=>
$value
)
{
if
(
$key
==
'_id'
)
{
//Kludge to let MongoCollection directly use this method
//without having to create an intermediary object or to
//browse each property twice, one to substitute _id, then here.
$instance
->
id
=
$value
;
}
$instance
->
$key
=
$value
;
}
return
$instance
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 7, 00:30 (16 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4243392
Default Alt Text
CollectionDocument.php (1 KB)
Attached To
Mode
rOBSIDIAN Obsidian Workspaces
Attached
Detach File
Event Timeline
Log In to Comment