Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12742599
CollectionDocument.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
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
*/
/**
* Collection document class
*
* This class repreesnts 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
*
* @return moxed data which can be serialized by json_encode()
*/
public
function
jsonSerialize
()
{
return
$this
;
}
/**
* Loads a CollectionDocument instance from a generic object.
*
* @param object $data The object to deserialize
* @return object The deserialized instance
*/
public
static
function
loadFromObject
(
$data
)
{
$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
Sun, Nov 16, 13:50 (10 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3158289
Default Alt Text
CollectionDocument.php (1 KB)
Attached To
Mode
rOBSIDIAN Obsidian Workspaces
Attached
Detach File
Event Timeline
Log In to Comment