ComplexDataDefinitionBase.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php
  2. 8.9.x core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php
  3. 11.x core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php

Namespace

Drupal\Core\TypedData

File

core/lib/Drupal/Core/TypedData/ComplexDataDefinitionBase.php

View source
<?php

namespace Drupal\Core\TypedData;


/**
 * Base class for complex data definitions.
 */
abstract class ComplexDataDefinitionBase extends DataDefinition implements ComplexDataDefinitionInterface {
    
    /**
     * An array of data definitions.
     *
     * @var \Drupal\Core\TypedData\DataDefinitionInterface[]
     */
    protected $propertyDefinitions;
    
    /**
     * {@inheritdoc}
     */
    public abstract function getPropertyDefinitions();
    
    /**
     * {@inheritdoc}
     */
    public function getPropertyDefinition($name) {
        $definitions = $this->getPropertyDefinitions();
        if (isset($definitions[$name])) {
            return $definitions[$name];
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public function getMainPropertyName() {
        return NULL;
    }
    
    /**
     * {@inheritdoc}
     */
    public function __sleep() {
        // Do not serialize the cached property definitions.
        $vars = get_object_vars($this);
        unset($vars['propertyDefinitions'], $vars['typedDataManager']);
        return array_keys($vars);
    }

}

Classes

Title Deprecated Summary
ComplexDataDefinitionBase Base class for complex data definitions.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.