public function createBulkResourceforResourceSet(
        ResourceSet $sourceResourceSet,
        array $data
    ) {
        $verbName = 'bulkCreate';
        $mapping = $this->getOptionalVerbMapping($sourceResourceSet, $verbName);

        $result = [];
        try {
            DB::beginTransaction();
            if (null === $mapping) {
                foreach ($data as $newItem) {
                    $raw = $this->getQuery()->createResourceforResourceSet($sourceResourceSet, null, $newItem);
                    if (null === $raw) {
                        throw new \Exception('Bulk model creation failed');
                    }
                    $result[] = $raw;
                }
            } else {
                $keyDescriptor = null;
                $pastVerb = 'created';
                $result = $this->processBulkCustom($sourceResourceSet, $data, $mapping, $pastVerb, $keyDescriptor);
            }
            DB::commit();
        } catch (\Exception $e) {
            DB::rollBack();
            throw $e;
        }
        return $result;
    }
public function createBulkResourceforResourceSet(
        ResourceSet $sourceResourceSet,
        array $data
    ) {
        $verbName = 'bulkCreate';
        $mapping = $this->getOptionalVerbMapping($sourceResourceSet, $verbName);

        $result = [];
        try {
            DB::beginTransaction();
            if (null === $mapping) {
                foreach ($data as $newItem) {
                    $raw = $this->getQuery()->createResourceforResourceSet($sourceResourceSet, null, $newItem);
                    if (null === $raw) {
                        throw new \Exception('Bulk model creation failed');
                    }
                    $result[] = $raw;
                }
            } else {
                $keyDescriptor = null;
                $pastVerb = 'created';
                $result = $this->processBulkCustom($sourceResourceSet, $data, $mapping, $pastVerb, $keyDescriptor);
            }
            DB::commit();
        } catch (\Exception $e) {
            DB::rollBack();
            throw $e;
        }
        return $result;
    }
public function createBulkResourceforResourceSet ( ResourceSet $ sourceResourceSet , array $ data ) { $ verbName = 'bulkCreate' ; $ mapping = $ this -> getOptionalVerbMapping ( $ sourceResourceSet , $ verbName ) ; $ result = [ ] ; try { DB :: beginTransaction ( ) ; if ( null === $ mapping ) { foreach ( $ data as $ newItem ) { $ raw = $ this -> getQuery ( ) -> createResourceforResourceSet ( $ sourceResourceSet , null , $ newItem ) ; if ( null === $ raw ) { throw new \ Exception ( 'Bulk model creation failed' ) ; } $ result [ ] = $ raw ; } } else { $ keyDescriptor = null ; $ pastVerb = 'created' ; $ result = $ this -> processBulkCustom ( $ sourceResourceSet , $ data , $ mapping , $ pastVerb , $ keyDescriptor ) ; } DB :: commit ( ) ; } catch ( \ Exception $ e ) { DB :: rollBack ( ) ; throw $ e ; } return $ result ; }
Create multiple new resources in a resource set.

@param ResourceSet $sourceResourceSet The entity set containing the entity to fetch
@param object[]    $data              The new data for the entity instance

@return object[] returns the newly created model if successful, or throws an exception if model creation failed
@throw  \Exception
Create multiple new resources in a resource set .