If field exists and is not array - convert to array and append
If field -s array - append
public append ( type $selector, type $value ) : |
||
$selector | type | |
$value | type | |
return |
/** * If field not exist - set value. * If field exists and is not array - convert to array and append * If field -s array - append * * @param type $selector * @param type $value * @return \Sokil\Mongo\Structure */ public function append($selector, $value) { parent::append($selector, $value); // if document saved - save through update if ($this->getId()) { $this->operator->set($selector, $this->get($selector)); } return $this; }