We'll need support for data structures based upon complex data types that are not identifiable (=entities). For registering and describing the sub-properties we'll need a central hook, e.g. hook_data_type_info(). Maybe, we want to add primitive data types also to the hook. (Primitive data types may not be extensible though).

Then, we need a helper class + interface for easy use of complex data types, such that $entity->get('field_image') is an instance of that class and comes with useful helpers for deriving sub-properties or info.

Core implementations:
* Add data types for field types, i.e. file fields, image fields and formatted text.

Comments

fago’s picture

Title: add support for compound data types » add support for complex data types
fago’s picture

What about that naming + code-locations ?

  • Add hook_data_type_info() + define complex + primitive properties there.
  • Add a helper to retrieve data type info, system.module?
  • Add a class + interface: Drupal\Core\Utility\DataStructureInterface, Drupal\Core\Utility\DataStructure
  • Make the used class configurable via hook_data_type_info() + add a helper for constructing the objects, e.g. drupal_wrap_data_structure($type, array $values) (to common.inc?)
  • Let the EntityInterface extend Drupal\Core\Utility\DataStructureInterface
fago’s picture

also see some ideas of pounard:
http://drupal.org/node/1346220#comment-5860830

Maybe, we can get some ideas from the PHPCR API/interfaces too.

fmizzell’s picture

Assigned: Unassigned » fmizzell
fago’s picture

Status: Active » Fixed

That's already implemented in the current code, see the enity-property branch. For that there is PropertyContainerInterface as well as a PropertyTypeContainerInterface.

fmizzell’s picture

Assigned: fmizzell » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.