Create a pivot instance.

@param  mixed $data    The data.
@param  array $options Method options:
- `'exists'` _boolean_: Determines whether or not this entity exists
@return mixed          The pivot instance.
162409
protected function _item($data, $options = [])
    {
        $name = $this->_through;
        $parent = $this->_parent;
        $relThrough = $parent->schema()->relation($name);
        $through = $relThrough->to();
        $id = $this->_parent->id();
        $item = $through::create($id !== null ? $relThrough->match($this->_parent) : [], $options);
        $item->setAt($this->_using, $data, $options);
        return $item;
    }
1139368
public function  convert($data=false,$options= false){
		if (!$data) {
			return $data;
		};
		if (!isset($data[0])) {
			$data = array($data);
		}
					
		
		
		 		
		$this->scan($data);

	}
704794
public function newPivot(array $attributes = [], $exists = false)
	{
		$pivot = new MorphPivot($this->parent, $attributes, $this->table, $exists);

		$pivot->setPivotKeys($this->foreignKey, $this->otherKey)
			  ->setMorphType($this->morphType)
			  ->setMorphClass($this->morphClass);

		return $pivot;
	}
522465
public function provide($data = null, array $options = [])
    {
        if (!$data instanceof CsvField) {
            throw new InvalidArgumentException("Given data is not an instance of CsvField");
        }

        $data->setType($this->dbFieldType);

        $dbField = DbField::fromCsvField($data);
        $limit = (string)$dbField->getLimit();
        if (! empty($limit) && false !== strpos($limit, '.')) {
            list($precision, $scale) = explode('.', $limit);
            $fieldOptions = $dbField->getOptions();
            $fieldOptions['precision'] = $precision;
            $fieldOptions['scale'] = $scale;
            $dbField->setOptions($fieldOptions);
        }

        $result = [
            $data->getName() => $dbField,
        ];

        return $result;
    }
224886
protected function createForm($type, $data = null, array $options = array())
    {
        return $this->factory->create($type, $data, $options);
    }
1217753
public function provide($data = null, array $options = [])
    {
        $valueLabels = [
            0 => __('Off'),
            1 => __('On'),
        ];

        if (empty($options['valueLabels'])) {
            $options['valueLabels'] = $valueLabels;
        }
        $result = parent::provide($data, $options);

        return $result;
    }
162154
public function denormalise(array $data, array $options = [])
    {
        if (empty($data)) {
            return $data;
        }

        if (!isset($options["entityClass"])) {
            throw new NormalisationException("Cannot denormalise data without knowing the main entity class");
        }
        if (!isset($options["metadataProvider"])) {
            throw new NormalisationException("Cannot denormalise data without a metadata provider");
        }

        /** @var EntityMetadataProviderInterface $metadataProvider */
        $this->metadataProvider = $options["metadataProvider"];
        $metadata = $this->metadataProvider->getEntityMetadata($options["entityClass"]);

        // split fields based on prefix
        $prefixedFields = [];
        foreach ($data[0] as $field => $value) {
            $fieldParts = explode("__", $field);
            // if this field has no prefix, set it to an empty string
            if (count($fieldParts) == 1) {
                array_unshift($fieldParts, "");
            }
            // add the field to the prefix's array
            $prefix = $fieldParts[0];
            if (empty($prefixedFields[$prefix])) {
                $prefixedFields[$prefix] = [];
            }
            $prefixedFields[$prefix][$fieldParts[1]] = $field;
        }

        // handle case where only 1 prefix is present
        if (count($prefixedFields) == 1) {
            $fields = array_pop($prefixedFields);
            $primaryKey = $metadata->getPrimaryKey();
            if (isset($fields[$primaryKey])) {
                $this->primaryKeyFields = [$fields[$primaryKey] => true];
            }
            return $this->denormaliseData($data, $fields);
        }

        // complex result set
        if (!isset($options["entityMap"])) {
            throw new NormalisationException("Cannot denormalise data without an entity map");
        }

        $entityMap = $options["entityMap"];

        $collection = $metadata->getCollection();

        if (empty($prefixedFields[$collection])) {
            throw new NormalisationException("The collection '$collection' was not found in the fields array for this record set: '" . implode("', '", array_keys($prefixedFields)) . "'");
        }

        // reset primary key fields
        $this->primaryKeyFields = [];
        $this->treedEntities = [];
        $this->childRowAliases = [];

        $this->createFieldTree($prefixedFields, $entityMap, $collection, $options["entityClass"]);

        reset($data);
        $result = $this->denormaliseData($data, $prefixedFields[$collection], $collection);

        return  $result;
    }
884399
public function setCache(array $options, array $data) {
    array_multisort($options);
    $cache = GroupexFormCache::create([
      'field_gfc_created' => REQUEST_TIME,
      'field_gfc_options' => serialize($options),
      'field_gfc_response' => serialize($data)
    ]);
    $cache->setName('Cache item');
    $cache->save();
  }
303502
public function provide($data = null, array $options = [])
    {
        if (!$data instanceof CsvField) {
            throw new InvalidArgumentException("Given data is not an instance of CsvField");
        }

        $combinedFields = $this->config->getProvider('combinedFields');
        $combinedFields = new $combinedFields($this->config);
        $combinedFields = $combinedFields->provide($data, $options);

        $dbFields = [];
        foreach ($combinedFields as $suffix => $options) {
            $subField = clone $data;
            $subField->setName($data->getName() . '_' . $suffix);
            if (isset($options['limit'])) {
                $subField->setLimit($options['limit']);
            }

            $config = new $options['config']($subField->getName(), $this->config->getTable());
            $provider = $config->getProvider('fieldToDb');
            $provider = new $provider($config);
            $dbFields = array_merge($dbFields, $provider->provide($subField));
        }

        return $dbFields;
    }
273164
public function set(array $data, array $options = []) {
		$defaults = ['init' => false];
		$options += $defaults;

		$cast = ($schema = $this->schema());

		foreach ($data as $key => $val) {
			unset($this->_increment[$key]);
			if (strpos($key, '.')) {
				$this->_setNested($key, $val);
				continue;
			}
			if ($cast) {
				$pathKey = $this->_pathKey;
				$model = $this->_model;
				$parent = $this;
				$val = $schema->cast($this, $key, $val, compact('pathKey', 'model', 'parent'));
			}
			if ($val instanceof self) {
				$val->_exists = $options['init'] && $this->_exists;
				$val->_pathKey = ($this->_pathKey ? "{$this->_pathKey}." : '') . $key;
				$val->_model = $val->_model ?: $this->_model;
				$val->_schema = $val->_schema ?: $this->_schema;
			}
			$this->_updated[$key] = $val;
		}
	}
1046574
public function update(array $data, array $criteria = [], array $options = []) {
		return $this->getAdapter()->update(
			$this->getTableName(),
			$criteria,
			$data,
			$options
		);
	}
623424
public function newPivot(array $attributes = [], $exists = false)
    {

        $using = $this->using;

        $pivot = $using ? $using::fromRawAttributes($this->parent, $attributes, $this->table, $exists)
                        : new MorphPivot($attributes, $this->parent, $this->table, $exists);

        $pivot->setPivotKeys($this->foreignKey, $this->relatedKey)
              ->setMorphType($this->morphType)
              ->setMorphClass($this->morphClass);

        return $pivot;
    }
566606
protected function createPagination(array $data = null)
    {
        $pagination = new DatabasePagination();
        if ($data !== null) {
            $pagination->setData($data);
        }
        return $pagination;
    }
653253
public function write($data, array $options = [])
    {
        if (!$this->has_real_call) {
            $this->createRealCall($data);
            $this->has_real_call = true;
        }
        $this->real_call->write($data, $options);
    }
436319
public function insert($data, $options = [])
    {
        return $this->database->createCommand()->insert($this->name, $data, $options);
    }
4023
public function createForm($type, $data = null, array $options = [])
    {
        return $this->application['form.factory']->create($type, $data, $options);
    }
249733
public function deserialize(array $data, Options $options = null)
    {
        if (empty($options)) {
            $options = $this->optionsRepo->findOneBy(['id' => $data['id']]);
        }
        if (empty($options)) {
            $options = new Options();
        }
        if (isset($data['user'])) {
            $user = isset($data['user']['id']) ? $this->userRepo->findOneBy(['uuid' => $data['user']['id']]) : null;
            $options->setUser($user);
        }
        if (isset($data['data'])) {
            $options->setOptions($data['data']);
        }

        return $options;
    }