Ustawia kolekcję na podstawie obiektu obiektów
@param \Mmi\Orm\RecordCollection $data kolekcja obiektów DAO
@return \Mmi\Model\Api\Orm\DtoCollection
962469
public final function setFromDaoRecordCollection(\Mmi\Orm\RecordCollection $data)
    {
        $dtoClass = $this->_getDtoClass();
        $this->exchangeArray([]);
        foreach ($data as $record) {
            $this->append(new $dtoClass($record));
        }
        return $this;
    }
764856
protected function createCustomCollection($data = [], $class, $collection)
    {
        if (is_object($class)) {
            $class = get_class($class);
        }

        if (null === $data) {
            return $collection;
        }

        foreach ($data as $item) {
            $collection->add(null, $this->hydrate(new $class(), $item));
        }

        return $collection;
    }
1068137
protected function convertToResource($data)
    {
        return Collection::make($this->client, $data->id)
            ->init($data);
    }
492420
public function writeTypedObject($data)
    {
        $this->_stream->writeUTF($this->_className);
        $this->writeObject($data);
        return $this;
    }
367302
public function upload($data)
    {
        $chunk = new Chunk();
        $chunk->setData($data);
        $chunk->setLength(strlen($data));
        $chunk->setPolicyCollection(new PolicyCollection());
        $chunk->setHash($this->factory->createHash($data));

        if ($this->database->contains($chunk->getHash(), Chunk::class)) {
            return $chunk;
        }

        return $this->database->store($chunk, array(ReplicatorInterface::OPTION_NAME => ReplicatorInterface::TYPE_FULL));
    }
417008
public function create($data)
    {
        $fileDescriptor = new FileDescriptor($data->getHash());

        $fileDescriptor->setPackage(
            $this->extractPackageFromDocBlock($data->getDocBlock()) ?: $data->getDefaultPackageName()
        );

        $fileDescriptor->setName(basename($data->getFilename()));
        $fileDescriptor->setPath($data->getFilename());
        $fileDescriptor->setSource($data->getContents());
        $fileDescriptor->setIncludes(new Collection($data->getIncludes()));
        $fileDescriptor->setNamespaceAliases(new Collection($data->getNamespaceAliases()));

        $this->assembleDocBlock($data->getDocBlock(), $fileDescriptor);
        $this->overridePackageTag($data, $fileDescriptor);

        $this->addMarkers($data->getMarkers(), $fileDescriptor);
        $this->addConstants($data->getConstants(), $fileDescriptor);
        $this->addFunctions($data->getFunctions(), $fileDescriptor);
        $this->addClasses($data->getClasses(), $fileDescriptor);
        $this->addInterfaces($data->getInterfaces(), $fileDescriptor);
        $this->addTraits($data->getTraits(), $fileDescriptor);

        return $fileDescriptor;
    }
193427
protected function __apiStore(array $data = null)
    {
        if (is_null($data))
            $data = $this->getInputData();

        $record = HCCities::create(array_get($data, 'record'));

        return $this->apiShow($record->id);
    }
314285
public static function factory(Collection $data)
    {
        $instance = new static();

        $instance->id = (string) Uuid::uuid4();

        $instance->name = $data['name'];

        $instance->slug = str_slug($data['name']);

        $instance->graphEnabled = isset($data['graph_enabled'])
            ? $data['graph_enabled']
            : null;

        $instance->abbreviation = $data['abbreviation'];

        $instance->targets = $instance->instantiateTargets(
            $data['targets'] ?? collect()
        );

        $instance->notify =
            $data['notify'] ?? config('health.notifications.enabled');

        $instance->style = $instance->keysToCamel(config('health.style'));

        $instance->style['columnSize'] =
            $data['column_size'] ?? $instance->style['columnSize'];

        $instance->errorMessage =
            $data['error_message'] ?? config('health.errors.message');

        $instance->isGlobal = $data['is_global'] ?? false;

        $instance->checker = $instance->instantiateChecker($data['checker']);

        $instance->importProperties($data);

        return $instance;
    }
647733
public function addColumn(array $data)
    {
        $columnValidation = $this->_validateColumn($data);
        if (is_string($this->_validateColumn($data))) {
            throw new CollectionException('Invalid column data. '.$columnValidation);
        }

        $this->_columns[] = $data;

        return $this;
    }
695860
public function store(array $data)
    {
        $todo = $this->client->post(
            sprintf('buckets/%d/todolists/%d/todos.json', $this->bucket, $this->parent),
            [
                'json' => $data,
            ]
        );

        return new Todo($this->response($todo));
    }
303013
public function make($data)
    {
        if ($data instanceof Collection) {
            $this->data = collect($data->toArray());
        } elseif (is_array($data)) {
            $this->data = collect($data);
        } else {
            throw new InvalidArgumentException('Invalid data type.');
        }

        $this->config = Config::get('nestable');

        $this->parent = $this->config['parent'];

        $this->primary_key = $this->config['primary_key'];

        return $this;
    }
321048
public function create(array $data = [])
    {
        $collection = parent::create($data);

        if ($this->getCurrentCategory() && $this->getCurrentCategory()->getLevel() >= 2) {
            $collection->addAttributeToFilter('entity_id', ['neq' => (int) $this->getCurrentCategory()->getId()]);

            $rootPath      = array_slice($this->getCurrentCategory()->getPathIds(), 0, 2);
            $pathCondition = implode('/', $rootPath) . '%';
            $collection->addFieldToFilter('path', ['like' => $pathCondition]);
        }

        return $collection;
    }
378243
public function createImageCollection(array $data = [])
    {
        $collection = new Images();

        foreach ($data as $format => $formatCollection) {

            if (!is_array($formatCollection)) {
                continue;
            }

            foreach ($formatCollection as $item) {
                if (array_key_exists($format, Image::$formats)) {
                    $item = $this->create($item, $format);

                    $collection->addImage($item);
                }
            }
        }

        return $collection;
    }
511817
public function createNewRecord($data) {

        $email = new $this->model;

        $email->email_type_id = $data['email_type_id'];
        $email->title         = $data['title'];
        $email->description   = $data['description'];
        $email->comments      = $data['comments'];
        $email->created_at    = $data['created_at'];
        $email->created_by    = $data['created_by'];
        $email->updated_at    = $data['updated_at'];
        $email->updated_by    = $data['updated_by'];
        $email->locked_at     = null;
        $email->locked_by     = null;

        if ($email->save()) {

            // Return the new ID
            return $email->id;
        }

        return false;
    }
822506
public function setData($data)
    {
        foreach ($data as $key => $dtoData) {
            $this->data[$key] = new DetailsDto($dtoData);
        }
    
        return $this;
    }
1007283
protected function _handleUpload(array $data)
    {
        $files = [];
        //iteracja po tablicy plików
        foreach ($data as $fieldName => $fieldFiles) {
            //brak pliku o podanej nazwie
            if (!isset($files[$fieldName])) {
                $files[$fieldName] = [];
            }
            //pojedynczy plik
            if (null !== ($file = $this->_handleSingleUpload($fieldFiles))) {
                $files[$fieldName] = $file;
                continue;
            }
            //obsługa multiuploadu HTML5
            $files[$fieldName] = $this->_handleMultiUpload($fieldFiles);
        }
        return $files;
    }
1092146
public function create($data)
    {
    	try {
		    $data = is_object( $data ) ? $data : (object) $data;
		    $id   = 0;
		    try {
			    $entity = new \erdiko\users\entities\Role();
			    $entity->setName( $data->name );
			    $entity->setActive( $data->active );

			    $this->_em->persist( $entity );
			    $this->_em->flush();

			    $id = intval( $entity->getId() );
		    } catch ( \Exception $e ) {
			    \error_log( $e->getMessage() );
			    throw new \Exception( "Could not create Role." );
		    }

		    return (int) $id;
	    } catch (\Exception $e) {
    		throw new \Exception($e->getMessage());
	    }
    }