\Hazaar\MongoDB
EmbeddedDocument
Summary
Methods Properties Constants
get
has
key
set
sum
No constants
Properties
$changes
$changes
Holds any new non-child values that have changed
$cursor
$cursor
Internal database cursor

Tags

Internal
$new
$new
Holds any new children that overwrite values
$removes
$removes
Holds any non-child vlaues that have been removed
$values
$values
Holds the original child objects and values
Methods
__construct()
__construct($values = Array ( ) )

Constructor for a new EmbeddedDocument object. Optionally takes an argument of an array to use as values to populate the EmbeddedDocument with.

Tags

Since

1.0.0

Parameters

$valuesArray

Array of values to populate the document with.

__get()
__get($key)

Magic method to get a child element.

Parameters

$key

No description

__set()
__set($key, $value)

Parameters

$key

No description

$value

No description

__tostring()
__tostring()

__tostring fix – This fixes a bug where you get a value that doesn’t exist. When you do this it returns an empty Hazaar\\Db\\MongoDB\\EmbeddedDocument object, ready for work. This is because you may want to use it as an array so we pass it back to keep usage consistent. However, if it’s SUPPOSED to be a string, when you use it, it will error without this method, so we just return an empty string.

Tags

Since

1.0.0

__unset()
__unset($key)

Parameters

$key

No description

commit()
commit()
count()
count($committed_only = false)

Parameters

$committed_only

No description

current()
current()
delete()
delete()
extend()
extend($values, $whitelist = Array ( ) )

Parameters

$values

No description

$whitelist

No description

filterIn()
filterIn($value)

Input filter applied to child object as they are inserted into the document. This is used to convert some Hazaar specific objects into MongoDB object types. For example, converting an Hazaar\Date object, which stores Timezone data inside it into a an array with two elements:

  • datetime – which is a MongoDate object with the actual timestamp value
  • timezone – which is the timezone for the timestamp.

Tags

Since

1.0.0

Parameters

$valuemixed

The element to convert before adding

filterOut()
filterOut($value)

Output filter applied to child objects as they are read from the document. This is to undo any conversions made to objects with EmbeddedDocument::FilterIn().

Tags

Since

1.0.0

Parameters

$valuemixed

The element to check and possibly convert.

find()
find($criteria)

Parameters

$criteria

No description

findOne()
findOne($criteria)

Parameters

$criteria

No description

get()
get($key, $auto_create = true) : mixed

Method to get the current value of an element from the document.

Tags

Since

1.0.0

Parameters

$keymixed

The element key

$auto_createboolean

If the element does not exist, automatically create a new EmbeddedDocument with the requested key. Doing this allows sub-elements to be created and modified on the fly more conveniently. Default: true.

Returns

mixed

The value of the element at the key position

getChanges()
getChanges()
getNew()
getNew()
getRemoves()
getRemoves()
getValues()
getValues()

Return all values of the current document.

has()
has($key)

Parameters

$key

No description

hasChanges()
hasChanges()
hasNew()
hasNew()
hasRemoves()
hasRemoves()
isNull()
isNull($key)

Parameters

$key

No description

isRemoved()
isRemoved()
key()
key()
modify()
modify($values)

Parameters

$values

No description

next()
next()
offsetExists()
offsetExists($offset)

Parameters

$offset

No description

offsetGet()
offsetGet($offset)

ArrayAccess method to get a child element.

Parameters

$offset

No description

offsetSet()
offsetSet($offset, $value)

Parameters

$offset

No description

$value

No description

offsetUnset()
offsetUnset($offset)

Parameters

$offset

No description

populate()
populate($values)

Populate sets up the array with initial values.

  • This can be used to construct the initial array after it has been instatiated.
  • It can also be used to reset an array with different values

Tags

Since

1.0.0

Parameters

$valuesarray

An array of values to populate the document with

remove()
remove($criteria)

Parameters

$criteria

No description

reset()
reset()
rewind()
rewind()
set()
set($key, $value)

Parameters

$key

No description

$value

No description

sum()
sum($criteria = Array ( ) , $fields = Array ( ) , $recursive = false)

Parameters

$criteria

No description

$fields

No description

$recursive

No description

sumAll()
sumAll($fields, $combine = true)

Parameters

$fields

No description

$combine

No description

toArray()
toArray($ignore_changes = false)

Parameters

$ignore_changes

No description

valid()
valid()