Return an database storable column/value array.

@param mixed $value The value of the attribute

@return array
767069
public function serialize($value)
    {
        if ($value instanceof AnDomainAttributeInterface) {
            $value = $value->serialize();
        }

        return array((string) $this->_column => $value);
    }
992287
public function createWeightedList($value): array
    {
        return array_map(function ($data) {
            if ($data instanceof AcquirerWeight) {
                return $data;
            }

            return AcquirerWeight::createFromData((array) $data);
        }, $value);
    }
96924
public function appends($value)
    {
        $appends = explode(',', $value);
        $validator = validator([ 'values' => $appends ], [ 'values.*' => 'string' ]);
        $appends = collect($appends)->mapWithKeys(function ($append) {
            return [ $append => DB::raw("NULL as $append") ];
        })->toArray();
        return $this->builder->when(!$validator->fails(), function (Builder $query) use($appends) {
            if (is_null($query->getQuery()->columns)) {
                $query->select([ '*' => $query->qualifyColumn('*') ]);
                $query->addSelect($appends);
            }
        });
    }
1162990
public function transform($value)
    {
        foreach ($this->groupRolesConfiguration as $tables) {
            foreach ($tables as $package => $rows) {
                foreach ($rows as $row => $roles) {
                    foreach ($roles as $role => $configuration) {
                        $result[$package][$row][$role] = is_array($value) ? in_array($role, $value) : false;
                    }
                }
            }
        }

        return array('roles_collections' => $result);
    }
1075679
public function getUserValue($value)
    {
        if (! is_array($value)) {
            if ('' == $value) {
                $value = [];
            } else {
                $value = explode($this->getSeparator(), $value);
            }
        }

        return $value;
    }
874818
public static function convertToPhp($value)
    {
        if (!is_array($value)) {
            return [];
        }

        $elements = [];
        foreach ($value as $translatable) {
            $elements[] = TranslatableType::convertToPhp($translatable);
        }

        return $elements;
    }
775561
private function getValues($value)
    {
        if (is_array($value)) {
            $newValue = array();

            foreach ($value as $itemValue) {
                $newValue = array_merge($newValue, $this->getValues($itemValue));
            }

            return array($newValue);
        }

        if (is_object($value) && $this->em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
            $class = $this->em->getClassMetadata(get_class($value));
            if ($class->isIdentifierComposite) {
                $newValue = array();

                foreach ($class->getIdentifierValues($value) as $innerValue) {
                    $newValue = array_merge($newValue, $this->getValues($innerValue));
                }

                return $newValue;
            }
        }

        return array($this->getIndividualValue($value));
    }
1113923
public function getSqlType($value)
    {
        if ('boolean' === gettype($value)) {
            return $this->connection->getDatabasePlatform()->convertBooleans($value);
        } elseif (null === $value || 'null' === $value) {
            return 'NULL';
        }

        return $this->connection->quote($value);
    }
27395
protected function unserializeData($value)
    {
        if ($value === null || !is_array($value)) {
            return $value;
        }

        if (isset($value[self::MAP_TYPE]) && !isset($value[self::CLASS_IDENTIFIER_KEY])) {
            $value = $value[self::SCALAR_VALUE];

            return $this->unserializeData($value);
        }

        if (isset($value[self::SCALAR_TYPE])) {
            return $this->getScalarValue($value);
        }

        if (isset($value[self::CLASS_PARENT_KEY]) && 0 === strcmp($value[self::CLASS_PARENT_KEY], 'SplFixedArray')) {
            return SplFixedArraySerializer::unserialize($this, $value[self::CLASS_IDENTIFIER_KEY], $value);
        }

        if (isset($value[self::CLASS_IDENTIFIER_KEY])) {
            return $this->unserializeObject($value);
        }

        return \array_map([$this, __FUNCTION__], $value);
    }
232293
public function convert($value)
	{
		if (is_array(($value))) {
			$retval = [];
			foreach ($value as $object) {
				$retval[] = $this->convert($object); // force sequential indexing
			}

			return $retval;
		} else if (is_object($value)) {
			return $this->convertObject($value);
		} else {
			return $value;
		}
	}
1153954
public static function convertToPhp($value)
    {
        if (!is_array($value)) {
            return [];
        }

        // see DateType::convertToPHPValue()
        $convertor = function ($value) {
            try {
                return DateType::getDateTime($value);
            } catch (\InvalidArgumentException $e) {
                return null;
            }
        };

        return array_values(array_filter(array_map($convertor, $value)));
    }
189177
protected function convertValuesForStorage($values) {
    // filter values according to type
    foreach($values as $valueName => $value) {
      $type = $this->getAttribute($valueName)->getType();
      // integer
      if (strpos(strtolower($type), 'int') === 0) {
        $value = (strlen($value) == 0) ? null : intval($value);
        $values[$valueName] = $value;
      }
      // null values
      if ($value === null) {
        $values[$valueName] = SQLConst::NULL();
      }
    }
    return $values;
  }
347890
private function getValue($value)
    {
        switch ($this->attributes['type']) {
            case 'int':
            case 'integer':
                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                return (float) $value;
            case 'bool':
            case 'boolean':
                return (bool) $value;
            case 'collection':
                return new Collection(json_decode($value, true));
            case 'object':
                return json_decode($value);
            case 'array':
                return json_decode($value, true);
            default:
                return $value;
        }
    }
1100025
private function getValues($value)
    {
        if (is_array($value)) {
            $newValue = [];

            foreach ($value as $itemValue) {
                $newValue = array_merge($newValue, $this->getValues($itemValue));
            }

            return [$newValue];
        }

        $metadataFactory = $this->em->getMetadataFactory();
        $unitOfWork      = $this->em->getUnitOfWork();

        if (is_object($value) && $metadataFactory->hasMetadataFor(StaticClassNameConverter::getClass($value))) {
            $class     = $metadataFactory->getMetadataFor(get_class($value));
            $persister = $unitOfWork->getEntityPersister($class->getClassName());

            if ($class->isIdentifierComposite()) {
                $newValue = [];

                foreach ($persister->getIdentifier($value) as $innerValue) {
                    $newValue = array_merge($newValue, $this->getValues($innerValue));
                }

                return $newValue;
            }
        }

        return [$this->getIndividualValue($value)];
    }
1046346
public function quote($value)
    {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = $this->quote($v);
            }

            return $value;
        }
        if (is_null($value)) {
            return $value;
        }

        return $this->db->quoteValue($value);
    }
1222985
public function toArray($value)
    {
        if (empty($value)) {
            return null;
        }

        $output = [];
        foreach ($value as $val) {
            $output[] = $this->field->toArray($val);
        }

        return $output;
    }
309437
protected function databaseValue($values)
    {
        if ($values instanceof SetValue) {
            $values = $values->toArray();
        } else {
            if (!is_array($values)) {
                throw ODMException::invalidValueForType('Set', ['array', 'SetValue', 'null'], $values);
            }
        }

        if (count($values) === 0) {
            throw ODMException::setsCannotBeEmpty();
        }

        return $values;
    }