public function getDataArray(Entity $entity, $onlyChanged = false, $updateLoadedData = false)
	{
		$result = array();

		foreach ($this->getColumnsSchemas() as $fieldName => $schema) {
			$value = $this->getFieldValue($entity, $fieldName);
			if ($schema->getType() == 'Array') {
				if (!is_array($value) || !$value) {
					$value = json_encode([]);
				} else {
					$value = json_encode($value);
				}
			}
			if ($onlyChanged && array_key_exists($schema->getName(), $entity->getLoadedData())) {
				if ($schema->getType() == 'Boolean') {
					if ($value === ($entity->getLoadedData()[$schema->getName()] ? true : false)) {
						continue;
					}
				}
				if ($value === $entity->getLoadedData()[$schema->getName()]) {
					continue;
				}
			}
			if ($updateLoadedData) {
				$entity->getLoadedData()[$schema->getName()] = $value;
			}
			if (!$value) {
				if ($value === false) {
					$value = '0';
				} elseif ($value === 0) {
					$value = '0';
				}
			}
			$result[$schema->getName()] = $value;
		}

		return $result;
	}
public function getDataArray(Entity $entity, $onlyChanged = false, $updateLoadedData = false)
	{
		$result = array();

		foreach ($this->getColumnsSchemas() as $fieldName => $schema) {
			$value = $this->getFieldValue($entity, $fieldName);
			if ($schema->getType() == 'Array') {
				if (!is_array($value) || !$value) {
					$value = json_encode([]);
				} else {
					$value = json_encode($value);
				}
			}
			if ($onlyChanged && array_key_exists($schema->getName(), $entity->getLoadedData())) {
				if ($schema->getType() == 'Boolean') {
					if ($value === ($entity->getLoadedData()[$schema->getName()] ? true : false)) {
						continue;
					}
				}
				if ($value === $entity->getLoadedData()[$schema->getName()]) {
					continue;
				}
			}
			if ($updateLoadedData) {
				$entity->getLoadedData()[$schema->getName()] = $value;
			}
			if (!$value) {
				if ($value === false) {
					$value = '0';
				} elseif ($value === 0) {
					$value = '0';
				}
			}
			$result[$schema->getName()] = $value;
		}

		return $result;
	}
public function getDataArray ( Entity $ entity , $ onlyChanged = false , $ updateLoadedData = false ) { $ result = array ( ) ; foreach ( $ this -> getColumnsSchemas ( ) as $ fieldName => $ schema ) { $ value = $ this -> getFieldValue ( $ entity , $ fieldName ) ; if ( $ schema -> getType ( ) == 'Array' ) { if ( ! is_array ( $ value ) || ! $ value ) { $ value = json_encode ( [ ] ) ; } else { $ value = json_encode ( $ value ) ; } } if ( $ onlyChanged && array_key_exists ( $ schema -> getName ( ) , $ entity -> getLoadedData ( ) ) ) { if ( $ schema -> getType ( ) == 'Boolean' ) { if ( $ value === ( $ entity -> getLoadedData ( ) [ $ schema -> getName ( ) ] ? true : false ) ) { continue ; } } if ( $ value === $ entity -> getLoadedData ( ) [ $ schema -> getName ( ) ] ) { continue ; } } if ( $ updateLoadedData ) { $ entity -> getLoadedData ( ) [ $ schema -> getName ( ) ] = $ value ; } if ( ! $ value ) { if ( $ value === false ) { $ value = '0' ; } elseif ( $ value === 0 ) { $ value = '0' ; } } $ result [ $ schema -> getName ( ) ] = $ value ; } return $ result ; }
Returns array which used for update or insert SQL operations

@param Entity $entity
@param bool $onlyChanged
@param bool $updateLoadedData
@return array
Returns array which used for update or insert SQL operations