Attaches child model to parent model.

@param ResourceSet $sourceResourceSet
@param object      $sourceEntityInstance
@param ResourceSet $targetResourceSet
@param object      $targetEntityInstance
@param $navPropName

@return bool
162030
public function hookSingleModel(
        ResourceSet $sourceResourceSet,
        $sourceEntityInstance,
        ResourceSet $targetResourceSet,
        $targetEntityInstance,
        $navPropName
    ) {
        $relation = $this->isModelHookInputsOk($sourceEntityInstance, $targetEntityInstance, $navPropName);

        // in case the fake 'PrimaryKey' attribute got set inbound for a polymorphic-affected model, flatten it now
        unset($targetEntityInstance->PrimaryKey);

        if ($relation instanceof BelongsTo) {
            $relation->associate($targetEntityInstance);
        } elseif ($relation instanceof BelongsToMany) {
            $relation->attach($targetEntityInstance);
        } elseif ($relation instanceof HasOneOrMany) {
            $relation->save($targetEntityInstance);
        }
        LaravelQuery::queueModel($sourceEntityInstance);
        LaravelQuery::queueModel($targetEntityInstance);
        return true;
    }
532887
public function addInverseOneToOne($name, $targetEntity, $mappedBy)
    {
        $builder = $this->createOneToOne($name, $targetEntity);
        $builder->mappedBy($mappedBy);

        return $builder->build();
    }
1364165
public function copyFile($sourcePath, $targetPath, $filename)
    {
        // Check paths
        if ($sourcePath === $targetPath) {
            return;
        }

        $targetFilepath = $targetPath.$filename;

        // Check if file exists and create it
        if (file_exists($targetFilepath)) {
            return;
        }

        // Build new contents
        $sourceFilepath = $sourcePath.$filename;
        $ctns = '';

        // Check the old file to copy its contents
        if (file_exists($sourceFilepath)) {
            $copy = copy($sourceFilepath, $targetFilepath);
        } else {
            self::filePutContents($targetFilepath, '', 'This file has been auto-generated by the Zeus package without any content');
        }
    }
640524
private function getSourcePropertyValues(array $sourcePropertyPaths, $entity, $entityClass)
    {
        $sourcePropertyValues = [];

        foreach ($sourcePropertyPaths as $sourcePropertyPath) {
            if (!$this->propertyAccessor->isReadable($entity, $sourcePropertyPath)) {
                throw $this->createPropertyNotReadableException($entityClass, $sourcePropertyPath);
            }

            $sourcePropertyValues[$sourcePropertyPath] = $this->propertyAccessor->getValue($entity, $sourcePropertyPath);
        }

        return $sourcePropertyValues;
    }
585848
function createNavigationPropertyBinding(oAssociationSetFrom, oAssociationSetTo) {
				var oEntitySet = oEntityContainer[oAssociationSetFrom.entitySetName],
					oToRole = oAssociation.roles[oAssociationSetTo.roleName];

				if (oToRole.propertyName) {
					oEntitySet.$NavigationPropertyBinding
						= oEntitySet.$NavigationPropertyBinding || {};
					oEntitySet.$NavigationPropertyBinding[oToRole.propertyName]
						= oAssociationSetTo.entitySetName;
				}
			}
491391
public function getRelatedResourceReference(
        ResourceSet $sourceResourceSet,
        $sourceEntityInstance,
        ResourceSet $targetResourceSet,
        ResourceProperty $targetProperty
    ) {
        $entityClassName = $targetResourceSet->getResourceType()->getInstanceType()->name;
        $entityName = $this->getEntityName($entityClassName);
        $fieldName = $this->getTableName($entityName) . '_id';

        return $this->getResource($targetResourceSet, null, [
            'id' => $sourceEntityInstance->$fieldName
        ]);
    }
906449
public function connect(?string $sourceId, $sourceValue, ?string $destId, $destValue = null, $reference = null, bool $lazy = false, bool $weak = false, bool $byConstructor = false)
    {
        if (null === $sourceId || null === $destId) {
            return;
        }

        $sourceNode = $this->createNode($sourceId, $sourceValue);
        $destNode = $this->createNode($destId, $destValue);
        $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak, $byConstructor);

        $sourceNode->addOutEdge($edge);
        $destNode->addInEdge($edge);
    }
785184
public static function renameFolder( $sourceFolder, $targetName )
	{
		$targetName	= basename( $targetName );
		if( !self::isFolder( $sourceFolder ) )												//  Source Folder not existing
			throw new RuntimeException( 'Folder "'.$sourceFolder.'" is not existing' );

		$sourcePath	= self::correctPath( dirname( $sourceFolder ) );						//  Path to Source Folder
		if( basename( $sourceFolder ) == $targetName )										//  Source Name and Target name is equal
			return FALSE;
		if( self::isFolder( $sourcePath.$targetName ) )										//  Target Folder is already existing
			throw new RuntimeException( 'Folder "'.$sourcePath.$targetName.'" is already existing' );
		if( FALSE === @rename( $sourceFolder, $sourcePath.$targetName ) )					//  rename Source Folder to Target Folder
			throw new RuntimeException( 'Folder "'.$sourceFolder.'" cannot be renamed to "'.$sourcePath.$targetName.'"' );
		return TRUE;
	}
814518
public function getRelatedResourceSet(
        QueryType $queryType,
        ResourceSet $sourceResourceSet,
        $sourceEntityInstance,
        ResourceSet $targetResourceSet,
        ResourceProperty $targetProperty,
        $filterInfo = null,
        $orderBy = null,
        $top = null,
        $skip = null
    ) {
        // Correct filter
        $srcClass = get_class($sourceEntityInstance);
        $filterFieldName = $this->getTableName($this->getEntityName($srcClass)) . '_id';
        $navigationPropertiesUsedInTheFilterClause = null;
        $filterExpAsDataSourceExp = '';
        if ($filterInfo) {
            $navigationPropertiesUsedInTheFilterClause = $filterInfo->getNavigationPropertiesUsed();
            $filterExpAsDataSourceExp = $filterInfo->getExpressionAsString();
        }
        $filterExpAsDataSourceExp .= $filterExpAsDataSourceExp ? ' AND ' : '';
        $filterExpAsDataSourceExp .= $filterFieldName . ' = ' . $sourceEntityInstance->id;
        $completeFilterInfo = new FilterInfo($navigationPropertiesUsedInTheFilterClause, $filterExpAsDataSourceExp);

        return $this->getResourceSet($queryType, $targetResourceSet, $completeFilterInfo, $orderBy, $top, $skip);
    }
474077
SimpleRelation buildSimpleOneToOneOneToOne(Entity entity, final Attribute fromAttribute, Entity targetEntity, Attribute targetAttribute) {
        Namer targetNamer = relationUtil.getOneToOneNamer(fromAttribute, targetEntity.getModel());
        Namer inverseNamer = relationUtil.getInverseOneToOneNamer(fromAttribute, entity.getModel());
        SimpleRelation o2o = new SimpleOneToOne(inverseNamer, targetNamer, fromAttribute, entity, targetEntity, targetAttribute) {

            @Override
            protected AbstractRelation buildInverse() {
                SimpleOneToOne invo2o = new SimpleOneToOne(getTo(), getFrom(), getToAttribute(), getToEntity(), getFromEntity(), fromAttribute);
                OneToOneConfig iso2oConfig = getFromAttribute().getColumnConfig().getInverseOneToOneConfig();
                setLabelSingular(iso2oConfig, invo2o);
                configureActions(invo2o, cfg().getDefaultInverseOneToOneConfig(), iso2oConfig);
                return invo2o;
            }
        };

        OneToOneConfig o2oConfig = fromAttribute.getColumnConfig().getOneToOneConfig();
        setLabelSingular(o2oConfig, o2o);

        configureActions(o2o, cfg().getDefaultOneToOneConfig(), o2oConfig);
        return o2o;
    }
837842
protected function handleDataPreProcessor($source, $targetType, $currentPropertyPath)
    {
        if ($this->serviceFactory->has(ServiceInterface::SERVICE_DATA_PRE_PROCESSOR)) {
            /** @var DataPreProcessorService $dataProcessorService */
            $dataProcessorService = $this->serviceFactory->get(ServiceInterface::SERVICE_DATA_PRE_PROCESSOR);

            $processor = $dataProcessorService->getDataPreProcessor($source, $targetType);
            $source = $processor->getData();
            $processorResult = $processor->getResult();

            if ($processorResult->hasErrors()) {
                $this->messages->forProperty(implode('.', $currentPropertyPath))->merge($processorResult);
            }
        }

        return $source;
    }
583397
private function completeOwningSide(AssociationMetadata $property, $targetObject)
    {
        // add this object on the owning side as well, for obvious infinite recursion
        // reasons this is only done when called on the inverse side.
        if ($property->isOwningSide()) {
            return;
        }

        $mappedByField    = $property->getMappedBy();
        $targetMetadata   = self::$entityManager->getClassMetadata($property->getTargetEntity());
        $targetProperty   = $targetMetadata->getProperty($mappedByField);
        $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField;

        $targetObject->{$setterMethodName}($this);
    }
636908
public static function convertJsonToXml( $sourceFile, $targetFile )
	{
		$data	= self::loadJson( $sourceFile );
		return self::saveXml( $targetFile, $data );
	}
421130
public function uploadFile($sourcePath, $targetPath, $publicAccess = true, $allowRewriteFile = false)
	{
		// check if the file does not already exists, if exist, don't upload
		if ($allowRewriteFile !== true && $this->isFile($targetPath)) {
			return false;
		}
		return $this->s3Client->putObject(array(
			'Bucket'     => $this->getBucket(),
			'Key'        => $targetPath,
			'SourceFile' => $sourcePath,
			'ACL'        => $publicAccess ? self::PUBLIC_READ : self::PRIVATE_ACCESS
		));
	}
908665
protected function doMapping($source, $targetType, PropertyMappingConfigurationInterface $configuration, &$currentPropertyPath)
    {
        if ($source === null) {
            return null;
        }

        $typeConverter = $this->getTypeConverter($source, $targetType, $configuration);
        $targetType = ltrim($typeConverter->getTargetTypeForSource($source, $targetType), '\\');

        if (Core::get()->classExists($targetType)) {
            $targetType = $this->handleMixedType($source, $targetType, $currentPropertyPath);
            $source = $this->handleDataPreProcessor($source, $targetType, $currentPropertyPath);

            if (MixedTypesResolver::OBJECT_TYPE_NONE === $targetType) {
                return null;
            }
        }

        $convertedChildProperties = (is_array($source))
            ? $this->convertChildProperties($source, $targetType, $typeConverter, $configuration, $currentPropertyPath)
            : [];

        $this->configurationObjectConversionDTO
            ->setSource($source)
            ->setTargetType($targetType)
            ->setConvertedChildProperties($convertedChildProperties)
            ->setCurrentPropertyPath($currentPropertyPath)
            ->setResult(null);
        $this->serviceFactory->runServicesFromEvent(ObjectConversionBeforeServiceEventInterface::class, 'objectConversionBefore', $this->configurationObjectConversionDTO);

        if (null === $this->configurationObjectConversionDTO->getResult()) {
            $result = $typeConverter->convertFrom($source, $targetType, $convertedChildProperties);
            $this->configurationObjectConversionDTO->setResult($result);
        }

        $this->serviceFactory->runServicesFromEvent(ObjectConversionAfterServiceEventInterface::class, 'objectConversionAfter', $this->configurationObjectConversionDTO);
        $result = $this->configurationObjectConversionDTO->getResult();

        if ($result instanceof Error) {
            $this->messages
                ->forProperty(implode('.', $currentPropertyPath))
                ->addError($result);
        }

        return $result;
    }
1352007
public void registerClonedEntity(String sourceEntityId, String targetEntityId) {

        CmsEntityBackend.getInstance().getEntity(sourceEntityId).createDeepCopy(targetEntityId);
    }
367080
function buildDependantsSourceTree(sourceFileName, sourcesObject) {
  const depsTree = buildDependencyTreeFromSources(Object.keys(sourcesObject), sourcesObject);

  return buildFlatSourcesObjectFromTreeObject(depsTree[sourceFileName]);
}