Пример #1
0
 /**
  * Unset some fields and other stuff in metadat
  *
  * @param  string $key1
  * @param  string $key2
  * @param  array | string $unsets Ex. 'fields.name'
  *
  * @return bool
  */
 public function delete($key1, $key2, $unsets)
 {
     if (!is_array($unsets)) {
         $unsets = (array) $unsets;
     }
     $normalizedData = array('__APPEND__');
     $metaUnsetData = array();
     foreach ($unsets as $unsetItem) {
         $normalizedData[] = $unsetItem;
         $metaUnsetData[] = implode('.', array($key1, $key2, $unsetItem));
     }
     $unsetData = array($key1 => array($key2 => $normalizedData));
     $this->deletedData = Util::merge($this->deletedData, $unsetData);
     $this->deletedData = Util::unsetInArrayByValue('__APPEND__', $this->deletedData);
     $this->meta = Util::unsetInArray($this->getData(), $metaUnsetData);
 }