creates a ShippingItem Entity by a given (shipping-)data array
@param $data
@return ShippingItemEntity
@throws Exception\ShippingDependencyNotFoundException
@throws Exception\MissingShippingAttributeException
331263
private function createShippingItemEntity($data)
    {
        // check if necessary item data is set
        if (array_key_exists('item', $data) && array_key_exists('id', $data['item'])) {
            $itemId = $data['item']['id'];
            $item = $this->itemManager->findEntityById($itemId);
            if (!$item) {
                throw new ShippingDependencyNotFoundException('SuluSalesCoreBundle:Items', $itemId);
            }

            $shippingItem = new ShippingItemEntity();
            $shippingItem->setItem($item);
            $this->em->persist($shippingItem);
        } else {
            throw new MissingShippingAttributeException('ShippingItems.item.id');
        }

        return $shippingItem;
    }
940958
public function create($data = [])
    {
        if (! $data) {
            $data = $this->data;
        } else {
            $this->populate($data);
        }

        $response = $this->client->post('', [], $data);

        if (!$response->hasErrors()) {
            $this->event->dispatch('SUBSCRIPTION.UPDATE', new SubscriptionsEvent($this->data));
        }

        return $this;
    }
271072
public function create($data)
	{
		// @todo: Implement processing
		$processPayload = new Payload($data, Payload::STATUS_VALID); // @todo: Super temporary WIP

		// // Process data given.
		// $processPayload = $this->process(__FUNCTION__, $data);

		// if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		// {
		// 	return $processPayload;
		// }

		// Create the entity with the given data.
		$aggregatePayload = $this->aggregate[self::getEntityType()]->create($processPayload->getData());

		// No need to procede if dynamic content was not created.
		if( ! $aggregatePayload->isStatus(Payload::STATUS_CREATED))
		{
			return $aggregatePayload;
		}

		// Create the newly created entity's EntityIdentifier.
		$identifierPayload = $this->createIdentifier($aggregatePayload->getData());

		if( ! $identifierPayload->isStatus(Payload::STATUS_CREATED))
		{
			return $identifierPayload;
		}

		// @todo: The following currently adds an additional query just for the ease of getting the full entity to return.
		$createdEntityPayload = $this->getOneByUuid($aggregatePayload->getData()->getUuid());

		if( ! $createdEntityPayload->isStatus(Payload::STATUS_FOUND))
		{
			return $createdEntityPayload;
		}

		return new Payload($createdEntityPayload->getData(), $aggregatePayload->getStatus());
	}
724416
public function create($data) {
		$dt = $this->getDataTable();
		
		if (! $dt)
			return $this->createResponse($this->getNameManager()->getTableNames(), 401, "Tabels");
		
		return $this->createResponse([], 200, "{$this->getNameManager()->entityName}: No Create");
	}
1088635
public function newEntityCollection(array $data): array {
		if (empty($this->entityType)) {
			throw new EntityFactoryException("Cannot produce entity without type.", EntityFactoryException::UNSET_ENTITY_TYPE);
		}
		
		$entities = [];
		foreach ($data as $datum) {
			$entities[] = $this->newEntity($datum);
		}
		
		return $entities;
	}
121489
public static function fromData(array $data)
    {
        $class = get_called_class();
        $isDynamic = is_a($class, DynamicEntity::class, true);

        /** @var static $entity */
        $entity = (new \ReflectionClass($class))->newInstanceWithoutConstructor();

        object_set_properties($entity, $data, $isDynamic);

        if (method_exists($entity, '__construct')) {
            $entity->__construct();
        }

        $entity->markNew(false);

        return $entity;
    }
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());
	    }
    }
527441
public static function create($data) {
        global $DB;
        $data = (object)$data;
        $tagcolls = self::get_collections();
        $tagcoll = (object)array(
            'name' => $data->name,
            'isdefault' => 0,
            'component' => !empty($data->component) ? $data->component : null,
            'sortorder' => count($tagcolls),
            'searchable' => isset($data->searchable) ? (int)(bool)$data->searchable : 1,
            'customurl' => !empty($data->customurl) ? $data->customurl : null,
        );
        $tagcoll->id = $DB->insert_record('tag_coll', $tagcoll);

        // Reset cache.
        cache::make('core', 'tags')->delete('tag_coll');

        \core\event\tag_collection_created::create_from_record($tagcoll)->trigger();
        return $tagcoll;
    }
727579
public function newEntity(array $data): EntityInterface {
		if (empty($this->entityType)) {
			throw new EntityFactoryException("Cannot produce entity without type.", EntityFactoryException::UNSET_ENTITY_TYPE);
		}
		
		return new $this->entityType($data);
	}
946302
public function create($data)
	{
		// Process data given.
		$processPayload = $this->process(__FUNCTION__, $data);

		if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		{
			return $processPayload;
		}

		// Get a properly formatted Entity Class string.
		$entityContext = $this->formatEntityType($processPayload->getData()['entity_type']);

		// Create the entity with the given data.
		$entityPayload = $this->aggregate[$entityContext]->create($processPayload->getData());

		// No need to procede if dynamic content was not created.
		if($entityPayload->getStatus() != 'created')
		{
			return $entityPayload;
		}

		// Create the newly created entity's Identifier.
		$identifierPayload = $this->createIdentifier($entityPayload->getData());

		if($identifierPayload->getStatus() != 'created')
		{
			return $identifierPayload;
		}

		// @todo: The following currently adds an additional query just for the ease of getting the full entity to return.
		$createdEntityPayload = $this->getOneByUuid($entityPayload->getData()->getUuid());

		if($createdEntityPayload->getStatus() !== 'found')
		{
			return $createdEntityPayload;
		}

		return new Payload($createdEntityPayload->getData(), $entityPayload->getStatus());
	}
904633
public static function createFromData(array $data): self
    {
        if (!isset($data['method'])) {
            throw new DomainException(self::REQUIRED_METHOD);
        }

        switch ($data['method']) {
            case self::NONE:
                $paymentInstruction = new NoneType($data);

                break;
            case self::PARTIAL:
                $paymentInstruction = new PartialType($data);

                break;
            case self::DISCOUNT:
                $paymentInstruction = new DiscountType($data);

                break;
            default:
                throw new DomainException(
                    sprintf(self::UNSUPPORTED_METHOD, implode(',', self::$availableMethods))
                );
        }

        return $paymentInstruction;
    }
1019268
public function createFromArray(array $data)
    {
        $headers = json_encode(
            Arr::path($this->emailConfig, 'defaults.headers', [])
        );

        if (isset($data['sender_localpart'])) {
            if (! Arr::path($this->emailConfig, 'defaults.sender.domain')) {
                throw new \Exception('defaults.sender.domain not set in email config');
            }

            $data['sender_email'] = (
                Arr::remove($data, 'sender_localpart') . '@' .
                Arr::path($this->emailConfig, 'defaults.sender.domain')
            );
        }

        $defaults = [
            'headers'      => $headers,
            'sender_email' => Arr::path($this->emailConfig, 'defaults.sender.email'),
            'sender_name'  => Arr::path($this->emailConfig, 'defaults.sender.name'),
        ];

        $email = $this->emailMapper->getPrototype();

        $email = $email->exchangeArray(
            array_merge($defaults, $data)
        );

        $email = $this->emailMapper->persist($email);

        return $email;
    }
444279
public function createFromData(array $data): AbstractEntity
    {
        /** @var AbstractEntity $result */
        $result = $this->factory->create();
        $result->mapFromArray($data);
        return $result;
    }
375203
public static function createFromData(array $data)
    {
        if (!isset($data['type'])) {
            throw new DomainException(self::MSG_REQUIRED_TYPE);
        }

        switch ($data['type']) {
            case self::TYPE_FIXED:
                $discount = new Discounts\Fixed($data);

                break;
            case self::TYPE_PERCENT:
                $discount = new Discounts\Percent($data);

                break;
            default:
                throw new DomainException(
                    sprintf(self::MSG_UNSUPPORTED_TYPE, implode(',', self::$supportedTypes))
                );
        }

        return $discount;
    }
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;
    }
457537
public function insert($data = [])
	{
		$created = $this->model->insert($data);

		if( ! $created)
		{
			return new Payload(null, 'not_created');
		}

		return new Payload($created, 'created');
	}
99512
public function create($data)
    {
        $seo = new SeoViewObject();

        if (empty($data)) {
            return $seo;
        }

        $seo->title = $data['title'];
        $seo->description = $data['description'];
        $seo->keywords = $data['keywords'];
        $seo->canonicalUrl = $data['canonicalUrl'];
        $seo->noIndex = $data['noIndex'];
        $seo->noFollow = $data['noFollow'];
        $seo->hideInSitemap = $data['hideInSitemap'];

        return $seo;
    }