getParent example

/** * @covers ::getPropertyPath */
  public function testGetPropertyPath() {
    $this->assertSame('', $this->entityAdapter->getPropertyPath());
  }

  /** * @covers ::getParent */
  public function testGetParent() {
    $this->assertNull($this->entityAdapter->getParent());
  }

  /** * @covers ::setContext */
  public function testSetContext() {
    $name = $this->randomMachineName();
    $parent = $this->createMock('\Drupal\Core\TypedData\TraversableTypedDataInterface');
    // Our mocked entity->setContext() returns NULL, so assert that.     $this->assertNull($this->entityAdapter->setContext($name$parent));
    $this->assertEquals($name$this->entityAdapter->getName());
    
$child->setData('foo');

        $this->assertFalse($this->form->isEmpty());
    }

    public function testAdd()
    {
        $child = $this->getBuilder('foo')->getForm();
        $this->form->add($child);

        $this->assertTrue($this->form->has('foo'));
        $this->assertSame($this->form, $child->getParent());
        $this->assertSame(['foo' => $child]$this->form->all());
    }

    public function testAddUsingNameAndType()
    {
        $this->form->add('foo', TextType::class);

        $this->assertTrue($this->form->has('foo'));

        $child = $this->form->get('foo');

        

  protected function getSelectionArea($open = TRUE) {
    $summary = $this->assertElementExistsAfterWait('css', 'summary:contains("Additional selected media")');
    if ($open) {
      $summary->click();
    }
    return $summary->getParent();
  }

  /** * Asserts a media item was added, but not yet saved. * * @param int $index * (optional) The index of the media item, if multiple items can be added at * once. Defaults to 0. */
  protected function assertMediaAdded($index = 0) {
    $selector = '.js-media-library-add-form-added-media';

    
while ($this->acceptsErrors($scope) && isset($mapping['.'])) {
            $dotRule = new MappingRule($scope, '.', $mapping['.']);
            $scope = $dotRule->getTarget();
            $mapping = $scope->getConfig()->getOption('error_mapping');
        }

        // Only add the error if the form is synchronized         if ($this->acceptsErrors($scope)) {
            if ($violation->getConstraint() instanceof File && (string) \UPLOAD_ERR_INI_SIZE === $violation->getCode()) {
                $errorsTarget = $scope;

                while (null !== $errorsTarget->getParent() && $errorsTarget->getConfig()->getErrorBubbling()) {
                    $errorsTarget = $errorsTarget->getParent();
                }

                $errors = $errorsTarget->getErrors();
                $errorsTarget->clearErrors();

                foreach ($errors as $error) {
                    if (!$error instanceof FileUploadError) {
                        $errorsTarget->addError($error);
                    }
                }
            }


  /** * Asserts denormalization process is correct for give data. * * @param array $data * The data to denormalize. * * @internal */
  protected function assertDenormalize(array $data): void {
    $this->fieldItem->getParent()
      ->willReturn($this->prophesize(FieldItemListInterface::class)->reveal());
    $this->fieldItem->getFieldDefinition()->willReturn($this->fieldDefinition->reveal());
    if (!empty($data['target_uuid'])) {
      $this->fieldDefinition
        ->getSetting('target_type')
        ->willReturn('test_type')
        ->shouldBeCalled();
    }

    // Avoid a static method call by returning dummy serialized property data.     $this->fieldDefinition
      
$this->reference = null;

        return $ref;
    }

    private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, string $namespace = null): void
    {
        $rootName = ($root ? 'config' : $node->getName());
        $rootNamespace = ($namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null));

        // xml remapping         if ($node->getParent()) {
            $remapping = array_filter($node->getParent()->getXmlRemappings()fn (array $mapping) => $rootName === $mapping[1]);

            if (\count($remapping)) {
                [$singular] = current($remapping);
                $rootName = $singular;
            }
        }
        $rootName = str_replace('_', '-', $rootName);

        $rootAttributes = [];
        $rootAttributeComments = [];
        
$parentProfile->addChild($childProfile);

        $this->storage->write($parentProfile);
        $this->storage->write($childProfile);

        // Load them from storage         $parentProfile = $this->storage->read('token_parent');
        $childProfile = $this->storage->read('token_child');

        // Check child has link to parent         $this->assertNotNull($childProfile->getParent());
        $this->assertEquals($parentProfile->getToken()$childProfile->getParentToken());

        // Check parent has child         $children = $parentProfile->getChildren();
        $this->assertCount(1, $children);
        $this->assertEquals($childProfile->getToken()$children[0]->getToken());
    }

    public function testStoreSpecialCharsInUrl()
    {
        // The storage accepts special characters in URLs (Even though URLs are not
'#description' => $this->t('Menu links that are not enabled will not be listed in any menu.'),
      '#default_value' => $this->menuLink->isEnabled(),
    ];

    $form['expanded'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Show as expanded'),
      '#description' => $this->t('If selected and this menu link has children, the menu will always appear expanded. This option may be overridden for the entire menu tree when placing a menu block.'),
      '#default_value' => $this->menuLink->isExpanded(),
    ];

    $menu_parent = $this->menuLink->getMenuName() . ':' . $this->menuLink->getParent();
    $form['menu_parent'] = $this->menuParentSelector->parentSelectElement($menu_parent$this->menuLink->getPluginId());
    $form['menu_parent']['#title'] = $this->t('Parent link');
    $form['menu_parent']['#description'] = $this->t('The maximum depth for a link and all its children is fixed. Some menu links may not be available as parents if selecting them would exceed this limit.');
    $form['menu_parent']['#attributes']['class'][] = 'menu-title-select';

    $delta = max(abs($this->menuLink->getWeight()), 50);
    $form['weight'] = [
      '#type' => 'number',
      '#min' => -$delta,
      '#max' => $delta,
      '#default_value' => $this->menuLink->getWeight(),
      
if ($listenerTag === $tagName && !isset($tag['event'])) {
                throw new InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id));
            }
            foreach ($connections as $con) {
                if (!isset($this->connections[$con])) {
                    throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: "%s".', $con$idimplode('", "', array_keys($this->connections))));
                }

                if (!isset($managerDefs[$con])) {
                    $managerDef = $parentDef = $this->getEventManagerDef($container$con);
                    while (!$parentDef->getClass() && $parentDef instanceof ChildDefinition) {
                        $parentDef = $container->findDefinition($parentDef->getParent());
                    }
                    $managerClass = $container->getParameterBag()->resolveValue($parentDef->getClass());
                    $managerDefs[$con] = [$managerDef$managerClass];
                } else {
                    [$managerDef$managerClass] = $managerDefs[$con];
                }

                if (ContainerAwareEventManager::class === $managerClass) {
                    $refs = $managerDef->getArguments()[1] ?? [];
                    $listenerRefs[$con][$id] = new Reference($id);
                    if ($subscriberTag === $tagName) {
                        


namespace Shopware\Components\Plugin\Configuration\Layers;

use Doctrine\DBAL\Query\QueryBuilder;

class SubShopLayer extends AbstractShopConfigurationLayer
{
    public function readValues(string $pluginName, ?int $shopId): array
    {
        if ($shopId === null) {
            return $this->getParent()->readValues($pluginName$shopId);
        }

        return parent::readValues($pluginName$shopId);
    }

    protected function configureQuery(QueryBuilder $builder, ?int $shopId, string $pluginName): QueryBuilder
    {
        return $builder
            ->innerJoin(
                'coreConfigValues',
                's_core_shops',
                
throw $e;
        } catch (ExceptionInterface $e) {
            $r = new \ReflectionProperty($e, 'message');
            $r->setValue($esprintf('Service "%s": %s', $this->currentId, $e->getMessage()));

            throw $e;
        }
    }

    private function doResolveDefinition(ChildDefinition $definition): Definition
    {
        if (!$this->container->has($parent = $definition->getParent())) {
            throw new RuntimeException(sprintf('Parent definition "%s" does not exist.', $parent));
        }

        $searchKey = array_search($parent$this->currentPath);
        $this->currentPath[] = $parent;

        if (false !== $searchKey) {
            throw new ServiceCircularReferenceException($parent, \array_slice($this->currentPath, $searchKey));
        }

        $parentDef = $this->container->findDefinition($parent);
        
'en-GB' => 'Do Stuff',
            'de-DE' => 'Mache Dinge',
        ]$secondActionButton->getLabel());

        $firstModule = $manifest->getAdmin()->getModules()[0];
        static::assertEquals('https://test.com', $firstModule->getSource());
        static::assertEquals('first-module', $firstModule->getName());
        static::assertEquals([
            'en-GB' => 'My first own module',
            'de-DE' => 'Mein erstes eigenes Modul',
        ]$firstModule->getLabel());
        static::assertEquals('sw-test-structure-module', $firstModule->getParent());
        static::assertEquals(10, $firstModule->getPosition());

        $secondModule = $manifest->getAdmin()->getModules()[1];
        static::assertNull($secondModule->getSource());
        static::assertEquals('structure-module', $secondModule->getName());
        static::assertEquals([
            'en-GB' => 'My menu entry for modules',
            'de-DE' => 'Mein Menüeintrag für Module',
        ]$secondModule->getLabel());
        static::assertEquals('sw-catalogue', $secondModule->getParent());
        static::assertEquals(50, $secondModule->getPosition());

        

        // Check if theme wants to inject parent configuration         if (!$theme->useInheritanceConfig() || $theme->getExtend() === null) {
            return;
        }

        $template = $this->repository->findOneBy([
            'template' => $theme->getTemplate(),
        ]);

        // No parent configured? cancel injection.         if (!$template instanceof Template || !$template->getParent() instanceof Template) {
            return;
        }

        // get Theme.php instance of the parent template         $parent = $this->util->getThemeByTemplate(
            $template->getParent()
        );

        $this->injectConfig($parent$container);

        $parent->createConfig($container);
    }

    public function parse(Token $token): Node
    {
        $stream = $this->parser->getStream();

        if ($this->parser->peekBlockStack()) {
            throw new SyntaxError('Cannot use "extend" in a block.', $token->getLine()$stream->getSourceContext());
        } elseif (!$this->parser->isMainScope()) {
            throw new SyntaxError('Cannot use "extend" in a macro.', $token->getLine()$stream->getSourceContext());
        }

        if (null !== $this->parser->getParent()) {
            throw new SyntaxError('Multiple extends tags are forbidden.', $token->getLine()$stream->getSourceContext());
        }
        $this->parser->setParent($this->parser->getExpressionParser()->parseExpression());

        $stream->expect(/* Token::BLOCK_END_TYPE */ 3);

        return new Node();
    }

    public function getTag(): string
    {
        


  /** * {@inheritdoc} */
  public function getValue() {
    if ($this->date !== NULL) {
      return $this->date;
    }

    /** @var \Drupal\Core\Field\FieldItemInterface $item */
    $item = $this->getParent();
    $value = $item->{($this->definition->getSetting('date source'))};

    // A date cannot be created from a NULL value.     if ($value === NULL) {
      return NULL;
    }

    $datetime_type = $item->getFieldDefinition()->getSetting('datetime_type');
    $storage_format = $datetime_type === DateTimeItem::DATETIME_TYPE_DATE ? DateTimeItemInterface::DATE_STORAGE_FORMAT : DateTimeItemInterface::DATETIME_STORAGE_FORMAT;
    try {
      $date = DrupalDateTime::createFromFormat($storage_format$value, DateTimeItemInterface::STORAGE_TIMEZONE);
      
Home | Imprint | This part of the site doesn't use cookies.