src/Model/Behavior/TagBehavior.php
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) {
		$field = $this->getConfig('field');
		$property = $this->getConfig('tagsAssoc.propertyName');
		$options['accessibleFields'][$property] = true;

		if (isset($data[$field])) {
			$data[$property] = $this->normalizeTags($data[$field]);
		} elseif ($field !== $property) {
			if (isset($data[$property]) && !is_array($data[$property])) {
				throw new RuntimeException('Your `' . $property . '` property is malformed (expected array instead of string). You configured to save list of tags in `' . $field . '` field.');
			}
		}

		if (isset($data[$field]) && empty($data[$field])) {
			unset($data[$field]);
		}
	}
public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) {
		$field = $this->getConfig('field');
		$property = $this->getConfig('tagsAssoc.propertyName');
		$options['accessibleFields'][$property] = true;

		if (isset($data[$field])) {
			$data[$property] = $this->normalizeTags($data[$field]);
		} elseif ($field !== $property) {
			if (isset($data[$property]) && !is_array($data[$property])) {
				throw new RuntimeException('Your `' . $property . '` property is malformed (expected array instead of string). You configured to save list of tags in `' . $field . '` field.');
			}
		}

		if (isset($data[$field]) && empty($data[$field])) {
			unset($data[$field]);
		}
	}
public function beforeMarshal ( Event $ event , ArrayObject $ data , ArrayObject $ options ) { $ field = $ this -> getConfig ( 'field' ) ; $ property = $ this -> getConfig ( 'tagsAssoc.propertyName' ) ; $ options [ 'accessibleFields' ] [ $ property ] = true ; if ( isset ( $ data [ $ field ] ) ) { $ data [ $ property ] = $ this -> normalizeTags ( $ data [ $ field ] ) ; } elseif ( $ field !== $ property ) { if ( isset ( $ data [ $ property ] ) && ! is_array ( $ data [ $ property ] ) ) { throw new RuntimeException ( 'Your `' . $ property . '` property is malformed (expected array instead of string). You configured to save list of tags in `' . $ field . '` field.' ) ; } } if ( isset ( $ data [ $ field ] ) && empty ( $ data [ $ field ] ) ) { unset ( $ data [ $ field ] ) ; } }
Before marshal callback

@param \Cake\Event\Event $event The Model.beforeMarshal event.
@param \ArrayObject $data Data.
@param \ArrayObject $options Options.
@return void
@throws \RuntimeException
Before marshal callback