getAutoload example

public function get($propertyName): ?Field
    {
        return $this->elements[$propertyName] ?? null;
    }

    public function getBasicFields(): self
    {
        return $this->filter(
            function DField $field) {
                if ($field instanceof AssociationField) {
                    return $field->getAutoload();
                }

                return true;
            }
        );
    }

    /** * @deprecated tag:v6.6.0 - Will be removed without replacement as it is unused * * @return list<string> */
return $associationViolations;
        }

        if ($association->is(CascadeDelete::class) && $reverseSide->is(CascadeDelete::class)) {
            $associationViolations[$definition->getClass()][] = sprintf(
                'Remove cascade delete in definition %s association: %s. One to One association should only have one side defined cascade delete flag',
                $definition->getClass(),
                $association->getPropertyName()
            );
        }

        if ($association->getAutoload() && $reverseSide->getAutoload()) {
            $associationViolations[$definition->getClass()][] = sprintf(
                'Remove autoload flag in definition %s association: %s. One to One association should only have one side defined as autoload, otherwise it leads to endless loops inside the DAL.',
                $definition->getClass(),
                $association->getPropertyName()
            );
        }

        $versionError = $this->validateVersionAwareness($reference$definition$association);
        if ($versionError) {
            $associationViolations[$definition->getClass()][] = $versionError;
        }

        
$errors = new ExceptionCollection();
        $pluginsFromFileSystem = $this->pluginFinder->findPlugins($this->pluginDir, $this->projectDir, $errors$composerIO);

        $installedPlugins = $this->getPlugins(new Criteria()$shopwareContext);

        $plugins = [];
        foreach ($pluginsFromFileSystem as $pluginFromFileSystem) {
            $baseClass = $pluginFromFileSystem->getBaseClass();
            $pluginPath = $pluginFromFileSystem->getPath();
            $info = $pluginFromFileSystem->getComposerPackage();

            $autoload = $info->getAutoload();
            if (empty($autoload) || (empty($autoload['psr-4']) && empty($autoload['psr-0']))) {
                $errors->add(new PluginComposerJsonInvalidException(
                    $pluginPath . '/composer.json',
                    ['Neither a PSR-4 nor PSR-0 autoload information is given.']
                ));

                continue;
            }

            $version = $info->getVersion();

            
// We need the root package so we can add our classmaps to its loader.     $package = $event->getComposer()->getPackage();
    // We need the local repository so that we can query and see if it's likely     // that our files are present there.     $repository = $event->getComposer()->getRepositoryManager()->getLocalRepository();
    // This is, essentially, a null constraint. We only care whether the package     // is present in the vendor directory yet, but findPackage() requires it.     $constraint = new Constraint('>', '');
    // It's possible that there is no classmap specified in a custom project     // composer.json file. We need one so we can optimize lookup for some of our     // dependencies.     $autoload = $package->getAutoload();
    if (!isset($autoload['classmap'])) {
      $autoload['classmap'] = [];
    }
    // Check for packages used prior to the default classloader being able to     // use APCu and optimize them if they're present.     // @see \Drupal\Core\DrupalKernel::boot()     if ($repository->findPackage('symfony/http-foundation', $constraint)) {
      $autoload['classmap'] = array_merge($autoload['classmap'][
        $vendor_dir . '/symfony/http-foundation/Request.php',
        $vendor_dir . '/symfony/http-foundation/RequestStack.php',
        $vendor_dir . '/symfony/http-foundation/ParameterBag.php',
        
/** @var \DateTimeInterface $createdAt */
        $createdAt = $plugin->getCreatedAt();

        $data = [
            'id' => Uuid::fromHexToBytes($plugin->getId()),
            'name' => $plugin->getName(),
            'version' => $plugin->getVersion(),
            'active' => $plugin->getActive() ? '1' : '0',
            'managed_by_composer' => $plugin->getManagedByComposer() ? '1' : '0',
            'base_class' => $plugin->getBaseClass(),
            'path' => $plugin->getPath(),
            'autoload' => json_encode($plugin->getAutoload(), \JSON_THROW_ON_ERROR),
            'created_at' => $createdAt->format(Defaults::STORAGE_DATE_TIME_FORMAT),
            'installed_at' => $installedAt ? $installedAt->format(Defaults::STORAGE_DATE_TIME_FORMAT) : null,
        ];

        $this->connection->insert('plugin', $data);
    }

    protected function getNotInstalledPlugin(): PluginEntity
    {
        $plugin = new PluginEntity();
        $plugin->assign([
            
foreach ($filtered as $field) {
            // translated fields are handled after loop all together             if ($field instanceof TranslatedField) {
                $this->queryHelper->resolveField($field$definition$root$query$context);

                $addTranslation = true;

                continue;
            }

            // self references can not be resolved if set to autoload, otherwise we get an endless loop             if (!$field instanceof ParentAssociationField && $field instanceof AssociationField && $field->getAutoload() && $field->getReferenceDefinition() === $definition) {
                continue;
            }

            // many to one associations can be directly fetched in same query             if ($field instanceof ManyToOneAssociationField || $field instanceof OneToOneAssociationField) {
                $reference = $field->getReferenceDefinition();

                $basics = $reference->getFields()->getBasicFields();

                $this->queryHelper->resolveField($field$definition$root$query$context);

                


                if ($field instanceof StorageAware) {
                    static::assertInstanceOf(StorageAware::class$actual$message);
                    static::assertSame($field->getStorageName()$actual->getStorageName()$message);
                }

                if ($field instanceof OneToManyAssociationField) {
                    static::assertInstanceOf(OneToManyAssociationField::class$actual$message);
                    static::assertSame($field->getReferenceField()$actual->getReferenceField()$message);
                    static::assertSame($field->getLocalField()$actual->getLocalField()$message);
                    static::assertSame($field->getAutoload()$actual->getAutoload()$message);
                    static::assertSame($field->getReferenceEntity()$actual->getReferenceEntity()$message);
                }

                if ($field instanceof ManyToManyAssociationField) {
                    static::assertInstanceOf(ManyToManyAssociationField::class$actual$message);
                    static::assertSame($field->getReferenceField()$actual->getReferenceField()$message);
                    static::assertSame($field->getLocalField()$actual->getLocalField()$message);
                    static::assertSame($field->getAutoload()$actual->getAutoload()$message);
                    static::assertSame($field->getMappingLocalColumn()$actual->getMappingLocalColumn()$message);
                    static::assertSame($field->getMappingReferenceColumn()$actual->getMappingReferenceColumn()$message);
                    static::assertSame($field->getReferenceEntity()$actual->getReferenceEntity()$message);
                }
Home | Imprint | This part of the site doesn't use cookies.