lithium\data\entity\Document::__unset()

public method

PHP magic method used when unset() is called on a Document instance.

Use case for this would be when you wish to edit a document and remove a field, ie.:

$doc = Posts::find($id);
unset($doc->fieldName);
$doc->save();

Parameters

  • string $name

    The name of the field to remove.

Returns

void

Source

	public function __unset($name) {
		$parts = explode('.', $name, 2);

		if (isset($parts[1])) {
			unset($this->{$parts[0]}[$parts[1]]);
		} else {
			unset($this->_updated[$name]);
			$this->_removed[$name] = true;
		}
	}