Factory

@param array $data [optional]
@return Record
512657
public function getNew($data = [])
    {
        $pk = $this->getPrimaryKey();
        if (is_string($pk) && isset($data[$pk]) && $this->getRegistry()->has($data[$pk])) {
            $return = $this->getRegistry()->get($data[$pk]);
            $return->writeData($data);
            $return->writeDBData($data);

            return $return;
        }

        $record = $this->getNewRecordFromDB($data);

        return $record;
    }
501504
public function createClone($data = []) {
		$collection = static::factory($data, $this->getModel(), $this->getPrimary());
		
		if ($this->hasDatagate()) {
			$collection->setDatagate($this->getDatagate());
		}
		
		if ($this->hasLocator()) {
			$collection->setLocator($this->getLocator());
		}
		
		return $collection;
	}
276
public function create(array $data)
    {
        if (! array_key_exists('name', $data)) {
            $data['name'] = Str::slug($data['display_name']);
        }

        return parent::create($data);
    }
75465
protected function createStructure( array $data )
    {
        $structure = $this->getStructureFactory()
                          ->factory( $data );

        if ( $structure instanceof MapperAwareInterface )
        {
            $structure->setMapper( $this );
        }

        if ( $structure instanceof SiteInfoAwareInterface )
        {
            $structure->setSiteInfo( $this->getSiteInfo() );
        }

        if ( $structure instanceof ServiceLocatorAwareInterface )
        {
            $structure->setServiceLocator( $this->getServiceLocator() );
        }

        return $structure;
    }
646519
public function create(array $data)
    {
        $response = $this->ontraport->post(
            $this->getNamespace(), $this->toArray($data)
        );

        return $this->ontraport->item($this, $response);
    }
99271
protected function createNewInstance(array $data): object
    {
        $instance = self::getInstantiator()->instantiate($this->getEntityClass());

        $refl = $this->getReflection();

        foreach ($data as $key => $value) {
            $prop = $refl->getProperty($key);
            $prop->setAccessible(true);

            if ($value instanceof Closure) {
                $value = $value($instance, $this, $this->manager);
            }

            $prop->setValue($instance, $value);
        }

        return $instance;
    }
637476
public function firstOrCreate(array $data)
    {
        if (!$row = $this->first($data)) {
            $row = $this->create($data);
        }

        return $row;
    }
1167685
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['filename'])) {
            $self->setFilename($data['filename']);
        }
        if (isset($data['format'])) {
            $self->setFormat($data['format']);
        }
        if (isset($data['state'])) {
            $self->setState($data['state']);
        }
        if (isset($data['created_at'])) {
            $self->setCreatedAt($data['created_at']);
        }

        return $self;
    }
566606
protected function createPagination(array $data = null)
    {
        $pagination = new DatabasePagination();
        if ($data !== null) {
            $pagination->setData($data);
        }
        return $pagination;
    }
625770
static public function create(array $data = null)
    {
        if (empty($data["type"]) && isset($data["transaction"])) {
            $type = $data["transaction"]["type"];
        }
        elseif (! $data || empty($data["type"])) {
            return new static($data);
        }
        else {
            $type = $data["type"];
        }

        // valid transaction type input
        $validTypes = array_keys(self::$typesClassMap);
        if (! $type || ! in_array($type, $validTypes)) {
            $type = TransactionType::TRANSFER;
        }

        // mutate transaction (morph specialized class)
        $classTx = self::$typesClassMap[$type];

        if ($type === TransactionType::TRANSFER
            && in_array($data["version"], [self::VERSION_2, self::VERSION_2_TEST, self::VERSION_2_MIJIN])) {

            $classTx = "\\NEM\\Models\\Transaction\\MosaicTransfer";
        }

        return new $classTx($data);
    }
826027
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['type'])) {
            $self->setType($data['type']);
        }
        if (isset($data['translated'])) {
            $self->setTranslated($data['translated']);
        }
        if (isset($data['flagged'])) {
            $self->setFlagged($data['flagged']);
        }
        if (isset($data['status'])) {
            $self->setStatus($data['status']);
        }
        if (isset($data['translation'])) {
            $self->setTranslation($data['translation']);
        }
        if (isset($data['revision'])) {
            $self->setRevision($data['revision']);
        }
        if (isset($data['comments'])) {
            $self->setComments($data['comments']);
        }
        if (isset($data['modified'])) {
            $self->setModified($data['modified']);
        }
        if (isset($data['author'])) {
            $self->setAuthor($data['author']);
        }
        if (isset($data['flagger'])) {
            $self->setFlagger($data['flagger']);
        }
        if (isset($data['locale'])) {
            $self->setLocale($data['locale']);
        }
        if (isset($data['plurals'])) {
            $self->setPlurals($data['plurals']);
        }

        return $self;
    }
1144418
public function create( $data )
	{
		$record = $this->fill( $data );

		if( is_array($record) )
		{
			$this->collection()->insert($record);
		}

		return $record;
	}
257355
public function create(array &$data = null) {
		$modelClass = $this->getModelClass();

		$model = $modelClass::factory($data);
		$model->setDatagate($this);

		if ($this->hasLocator()) {
			$model->setLocator($this->getLocator());
		}

		if (empty($data)) {
			$model->forceInsert();
		}

		return $model;
	}
863810
public function create(array $data = [])
    {
        $account = new Account();

        if (array_key_exists('avatar', $data)) {
            $account->setAvatar(
                $this->getAvatarFactory()->createCollection($data['avatar'])
            );
        }

        return $this->hydrate($account, $data);
    }
1151601
public static function fromArray(array $data)
    {
        return new PhpCsFixer(
            new Undefined(false),
            new Enabled($data['enabled']),
            PhpCsFixerLevelsFactory::fromArray($data['levels']),
            new PhpCsFixerOptions(isset($data['options']) ? $data['options'] : null)
        );
    }
1229757
public static function createFromArray(array $data): self
    {
        $obj = new self();
        $obj->name = $data['name'];
        $obj->type = $data['type'];
        $obj->origin = Place::createFromArray($data['Origin']);
        $obj->destination = Place::createFromArray($data['Destination']);

        if (isset($data['Notes']['text'])) {
            $obj->notes = self::setNotes($data['Notes']['text'], $data['type']);
        }

        if (isset($data['JourneyDetailRef']['ref'])) {
            $obj->journeyDetails = JourneyDetailParser::parseJourneyDetailUrl($data['JourneyDetailRef']['ref']);
        }

        return $obj;
    }
630573
public function create(array $data) {
        $this->_checkAcl('create');
        $pk = $this->_model->insert($data);
        return $pk;
    }