SlideShare a Scribd company logo
Wednesday, August 24, 11
Code & Coders




                 Entities - Emerging Patterns of Usage




                           Presented by Ronald Ashri (ronald_istos)

Wednesday, August 24, 11
@ronald_istos
                                   Web App Development
                                   Travel / Semantic Web
                                        www.istos.it




                                    Solutions for hotels,
                                        villas, B&Bs
                                     drupalrooms.com
                                      w/ Bluespark Labs




                                    Drupal Trainer network
                                     drupalteachers.com
                                        w/ Brightlemon


Wednesday, August 24, 11
Building with
    Entities

    ✤   How we got to entities

    ✤   What do they look like, what
        can we do, what’s missing

    ✤   When and how should we
        use them

         ✤    Learning from how they
              are used so far

    ✤   Questions / Next Steps



Wednesday, August 24, 11
slice up a drupal
    and you will find nodes
Wednesday, August 24, 11
drupalistas love making lots of nodes and
                 mixing them up in different ways
                          ... much like pasta
Wednesday, August 24, 11
they love them so much they nearly turned
                         everything into a node
Wednesday, August 24, 11
user pro les = drupal.org/project/content_pro le




Wednesday, August 24, 11
taxonomy = drupal.org/project/taxonomy_node




Wednesday, August 24, 11
comments = drupal.org/project/comment_nodes




Wednesday, August 24, 11
nodes come in different shapes but still tied to
            the same methods and db structure
          => need for a more generic core-based solution
Wednesday, August 24, 11
but the core development process
               is never simple
Wednesday, August 24, 11
Huge driver turned out to be the
                    Field API work -
        attaching elds to core “stuff” came rst
          and the need to streamline followed




Wednesday, August 24, 11
“loadable thingies,
       that can be optionally eldable”
        (http://drupal.org/node/460320)




Wednesday, August 24, 11
entities



Wednesday, August 24, 11
Entities in Drupal 7 are the nodes we really
              wanted but didn’t know it yet

       The stuff / content that makes up our site
     nodes, users, taxonomy terms, comments, les

                               User         Node


                           Taxonomy Term   Comment


                             Taxonomy        File
                             Vocabulary


Wednesday, August 24, 11
one day drupal
                will have a                               yeah... sure
                 smallcore                               and it will all
                                                             be OO




                           Drupal Core Developers Summit 2040


        Entities bring us closer to Drupal the framework
       No mention in UI - almost no mention in changelog

Wednesday, August 24, 11
CHANGELOG.TXT...


                           “In addition, any other object
                           type may register with Field API
                           and allow custom data elds to
                           be attached to itself.”


                                      object type = entity

Wednesday, August 24, 11
The relationships between Entities - the ways
        entities can interact with each other - de ne our
                        Drupal application

                        nodes can have comments
                           users author nodes
                  taxonomy terms are attached to nodes
                             these relationships are implicit -
                           perhaps they could be made explicit?


Wednesday, August 24, 11
how to cook - (or build entities)
Wednesday, August 24, 11
Your Table


          PostIt
           postit_id       name   property1   property2 property3




                                                     + elds
                                         (drupal worries about elds)


Wednesday, August 24, 11
you de ne an entity via a hook_entity_info (big array!):
    function postit_entity_info(){
      $postit_info['postit'] = array(
         'label' => t('PostIt Note'),
         'controller class' => 'PostItController',
         'base table' => 'postit',
         'uri callback' => 'postit_uri',
         'fieldable' => TRUE,
         'entity keys' => array(
            'id' => 'pid',
         ),
         'static cache' => TRUE,
         'bundles' => array(
            'postit'=> array(
               'label' => 'PostIt',
               'admin' => array(
                  'path' => 'admin/structure/postit/manage',
                  'access arguments' => array('administer postits'),
               ),
            ),
         ),
         'view modes' => array(
            'full' => array(
               'label' => t('Full PostIt'),
               'custom settings' => FALSE,
            ),
         )
      );
      return $postit_info;
    }
Wednesday, August 24, 11
function postit_entity_info(){
   $postit_info['postit'] = array(
     'label' => t('PostIt Note'),
             'controller class' => 'PostItController',
        'base table' => 'postit',
        'uri callback' => 'postit_uri',
        'fieldable' => TRUE,
           You can provide you own controller class - typically
        'entity keys' => array(
           'id' => 'pid',
        ), extending the default DrupalDefaultEntityController
        'static cache' => TRUE,
          which worries about caching, querying, revisioning and
        'bundles' => array(
           'postit'=> array(
                        attaching elds to entities
              'label' => 'PostIt',
              'admin' => array(
                 'path' => 'admin/structure/postit/manage',
                 'access arguments' => array('administer postits'),
              ),
           ),
        ),
        'view modes' => array(
           'full' => array(
              'label' => t('Full PostIt'),
              'custom settings' => FALSE,
           ),
        )
     );
     return $postit_info;
 }

Wednesday, August 24, 11
function postit_entity_info(){
   $postit_info['postit'] = array(
     'label' => t('PostIt Note'),
     'controller class' => 'PostItController',
       'base table' => 'postit',
       'uri callback' => 'postit_uri',
       'fieldable' => TRUE,
        'entity keys' => array(
           'id' => 'pid',
        ),
        'static cache' => TRUE,
                      base table = where our main entity data lives
        'bundles' => array(
                     uri callback = where to look up - view entities
           'postit'=> array(
              'label' => 'PostIt',
                     eldable = are elds to be attached to our entity
              'admin' => array(
                 'path' => 'admin/structure/postit/manage',
                 'access arguments' => array('administer postits'),
              ),
           ),
        ),
        'view modes' => array(
           'full' => array(
              'label' => t('Full PostIt'),
              'custom settings' => FALSE,
           ),
        )
     );
     return $postit_info;
 }

Wednesday, August 24, 11
function postit_entity_info(){
   $postit_info['postit'] = array(
     'label' => t('PostIt Note'),
     'controller class' => 'PostItController',
     'base table' => 'postit',
     'uri callback' => 'postit_uri',
     'fieldable' => TRUE,
     'entity keys' => array(
        'id' => 'pid',
     ),
     'static cache' => TRUE,
        'bundles' => array(
           'postit'=> array(
              'label' => 'PostIt',
              'admin' => array(
                 'path' => 'admin/structure/postit/manage',
                 'access arguments' => array('administer postits'),
              ),
           ),
        ),
        'view modes' => array(
           'full' => array(
              'label' => t('Full PostIt'),
                   Bundle = Entity + Con guration + Fields
              'custom settings' => FALSE,
           ),
        )
            1 entity (Node) can have many bundles (Article, Page)
     );
     return $postit_info;
 }
Wednesday, August 24, 11
tell drupal how to load your entity


   function postit_load($pid = NULL, $reset = FALSE){
       $pids = (isset ($pid) ? array($pid) : array());
       $postit = postit_load_multiple($pids, $reset);
       return $postit ? reset ($postit) : FALSE;
   }

   function postit_load_multiple($pids = array(), $conditions = array(), $reset = FALSE){
     return entity_load('postit', $pids, $conditions, $reset);
   }


   function entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) {
     if ($reset) {
       entity_get_controller($entity_type)->resetCache();
     }
     return entity_get_controller($entity_type)->load($ids, $conditions);
   }

Wednesday, August 24, 11
ready to cook!
    ✤   we also get a query API
        EntityFieldQuery

         ✤    conditions on properties
              and elds
         ✤    queries across entity types

    ✤   and we get hooks

         ✤    hook_entity_load()
         ✤    hook_entity_presave()
         ✤    hook_entity_insert()
         ✤    hook_entity_update()
         ✤    hook_entity_delete()
         ✤    hook_entity_prepare_view
         ✤    hook_entity_view()

Wednesday, August 24, 11
Young module developer : Where is full CRUD, UI,
    Views integration, Tokens, Search, etc?




                           Drupal Core: What? Am I supposed to
                               do everything around here?

Wednesday, August 24, 11
+ Entity Module
        (drupal.org/project/entity)

    ✤   Supports full CRUD
    ✤   Quickly provide new entity
        types
    ✤   Standardised way of
        working with entity data
    ✤   Integration into drupal
        ecosystem (Tokens, Views,
        Rules, Exportables, Search
        API, RestWS, VBO)
    ✤   Full Tests

Wednesday, August 24, 11
so what are we cooking - and how?
                                        and why?




Wednesday, August 24, 11
entities are a uniquely drupaly concept

                                         your stuff
                           (your db table or something like that)
                                              +
                                         Field API
                                              +
                                hooks in the drupal world




Wednesday, August 24, 11
if your module / app is introducing data
             you should really be asking yourself
                    why not via entities

       you get plugged in to the drupal world
              for (almost) zero cost and
         your data can remains as is (almost)


Wednesday, August 24, 11
emerging patterns

Wednesday, August 24, 11
Commerce


    ✤   Great example as there is
        also historical perspective
    ✤   D6 Ubercart did almost
        everything “outside” of
        Drupal
    ✤   D7 Commerce is a fully
        signed up member to the
        Drupal ecosystem



Wednesday, August 24, 11
in order to add commerce capabilities we need to
          introduce a whole set of concepts (and their supporting
                              data structures)

      Drupal Commerce de nes

              Customer Pro les
              Lines Items
              Orders
              Payment Transactions
              Products

      as entities


Wednesday, August 24, 11
Drupal Commerce defines only as much as it
      needs in terms of fields attached to these entities -

      Application core concepts (e.g. sku for product)
      live in entity base table not via field

      More complex core data (e.g. price) gets added via
      a locked field

      Allows the user add extra fields where it makes
      sense

Wednesday, August 24, 11
local action   entity types




         Entity
                                                 operational links
   Listing as a View


Wednesday, August 24, 11
Contains Line
                           Order Entity
                                               Item Entities




                                                                  Related to
                                                               payment entities




                                    address eld eld



                             looks familiar!




Wednesday, August 24, 11
use entities to introduce new data types that can
                          be user-extensible

                  provide minimum conf required - easily
                customisable in install profiles or via custom
                                  modules

          ps: did I mention - you really, really, really need a good reason not to use
               entities when introducing new data (and data tables) to Drupal




Wednesday, August 24, 11
Profile 2



    ✤   Separates users from
        descriptions of users

    ✤   Uses different bundles to
        describe different aspects of
        the same user

    ✤   Use entities to provide pro le
        level type permissions




Wednesday, August 24, 11
placed under      Entity Module UI
                           admin/structure   for handling types




                                                 per type
                                               con guration




Wednesday, August 24, 11
use new entity relationships to extend the
                                   application

                           provide configuration via entity types




Wednesday, August 24, 11
Organic Groups

    ✤   Organic Groups uses
        Entities because via the
        Entity API it gets CRUD,
        Views, Rules integration
        etc for free
    ✤   Groups are still attached
        to nodes
    ✤   Automatically created via
        an indirect user action



Wednesday, August 24, 11
Group Entity


                                               when you create a
                                                node as a Group
                                                Type this triggers
                                               the creation of the
                                                  Group Entity




         separation of concerns opens up interesting possibilities
           and enables things that were not possible before like
                    better internationalization support

Wednesday, August 24, 11
Group Membership Entity




              content         group




Wednesday, August 24, 11
because relationships are entities we can
                     add elds to them

                  e.g. date eld indicating relationship
                               expiration




Wednesday, August 24, 11
use Entities to separate concerns
                                        -
                  using the Field API as a way to exibly add
                        access to con guration options
                                        -

                  Site builder can decide how much con g to make
                                available to Site Admins



Wednesday, August 24, 11
Rooms

    ✤   Hotel booking application
    ✤   Introduces Bookable
        Units and Bookings as
        entities
    ✤   Relates entities to non
        entify-able data
    ✤   Uses entity types for
        default values settings as
        well as a source of
        common data across all
        entities instances
Wednesday, August 24, 11
Bookable Unit Entity




Wednesday, August 24, 11
Bookable Unit Availability




Wednesday, August 24, 11
Entity Types de ne default property values




Wednesday, August 24, 11
Rooms




                                   interact via entities




                                               Commerce




Wednesday, August 24, 11
Kickstarting
    Development
    entities in a jar




Wednesday, August 24, 11
Model Entities

                                  drupal.org/project/model


    Implementation of a
    generic Entity and Entity
    Administration interface
    that you can use to
    kickstart your own project.




Wednesday, August 24, 11
experiment and
    learn from
    others
    doing it your way is great...
    but also need to study and share patterns
    for doing things




Wednesday, August 24, 11
Summary

    ✤   Drupalize your data with
        entities
    ✤   Improves distinction
        between drupal the
        framework and drupal the
        CMS impoving app
        development
    ✤   Leverage the entity
        module
    ✤   Learn from examples

Wednesday, August 24, 11
@ronald_istos

                                     Web App Development
                                     Travel / Semantic Web
                                          www.istos.it



                                      Solutions for hotels,
                                          villas, B&Bs
                                       drupalrooms.com
                                       w/ Bluespark Labs



                                      Drupal Trainer network
                                       drupalteachers.com
                                         w/ Brightlemon

Wednesday, August 24, 11
What did you think?
             Locate this session on the
             DrupalCon London website:
             http://london2011.drupal.org/conference/schedule


             Click the “Take the survey” link

            THANK YOU!

Wednesday, August 24, 11

More Related Content

What's hot

What's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field APIWhat's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field API
Drupalize.Me
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
Synapseindiappsdevelopment
 
Advanced php
Advanced phpAdvanced php
Advanced phphamfu
 
J query1
J query1J query1
J query1
Manav Prasad
 
J query
J queryJ query
J query
Manav Prasad
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
Jonathan Wage
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
Jonathan Wage
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryRebecca Murphey
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
Shah Jalal
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMJonathan Wage
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
Darren Mothersele
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMJonathan Wage
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
Garann Means
 
Dig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup CairoDig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup Cairo
Mohamed Mosaad
 
Doctrine and NoSQL
Doctrine and NoSQLDoctrine and NoSQL
Doctrine and NoSQL
Benjamin Eberlei
 
Doctrine for NoSQL
Doctrine for NoSQLDoctrine for NoSQL
Doctrine for NoSQL
Benjamin Eberlei
 
Drupal Field API. Practical usage
Drupal Field API. Practical usageDrupal Field API. Practical usage
Drupal Field API. Practical usage
Pavel Makhrinsky
 
Drupal csu-open atriumname
Drupal csu-open atriumnameDrupal csu-open atriumname
Drupal csu-open atriumname
Emanuele Quinto
 

What's hot (20)

What's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field APIWhat's New in Drupal 8: Entity Field API
What's New in Drupal 8: Entity Field API
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
 
Advanced php
Advanced phpAdvanced php
Advanced php
 
J query1
J query1J query1
J query1
 
J query
J queryJ query
J query
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Doctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document MapperDoctrine MongoDB Object Document Mapper
Doctrine MongoDB Object Document Mapper
 
Field api.From d7 to d8
Field api.From d7 to d8Field api.From d7 to d8
Field api.From d7 to d8
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQuery
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 JavascriptjQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
 
Symfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODMSymfony Day 2010 Doctrine MongoDB ODM
Symfony Day 2010 Doctrine MongoDB ODM
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
 
Dig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup CairoDig Deeper into WordPress - WD Meetup Cairo
Dig Deeper into WordPress - WD Meetup Cairo
 
Doctrine and NoSQL
Doctrine and NoSQLDoctrine and NoSQL
Doctrine and NoSQL
 
Doctrine for NoSQL
Doctrine for NoSQLDoctrine for NoSQL
Doctrine for NoSQL
 
Ms Ajax Dom Element Class
Ms Ajax Dom Element ClassMs Ajax Dom Element Class
Ms Ajax Dom Element Class
 
Drupal Field API. Practical usage
Drupal Field API. Practical usageDrupal Field API. Practical usage
Drupal Field API. Practical usage
 
Drupal csu-open atriumname
Drupal csu-open atriumnameDrupal csu-open atriumname
Drupal csu-open atriumname
 

Viewers also liked

The Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservicesThe Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservices
Ronald Ashri
 
Drupal 7 Queues
Drupal 7 QueuesDrupal 7 Queues
Drupal 7 Queues
Philip Norton
 
Message Queues and Drupal
Message Queues and DrupalMessage Queues and Drupal
Message Queues and Drupal
Brian Altenhofel
 
Life after the hack
Life after the hackLife after the hack
Life after the hack
OSInet
 
Faster Drupal sites using Queue API
Faster Drupal sites using Queue APIFaster Drupal sites using Queue API
Faster Drupal sites using Queue API
OSInet
 
Component Driven Development - DrupalCamp London 2017
Component Driven Development - DrupalCamp London 2017Component Driven Development - DrupalCamp London 2017
Component Driven Development - DrupalCamp London 2017
John Ennew
 
Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8
Peter Vanhee
 

Viewers also liked (7)

The Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservicesThe Why and How of Applications with APIs and microservices
The Why and How of Applications with APIs and microservices
 
Drupal 7 Queues
Drupal 7 QueuesDrupal 7 Queues
Drupal 7 Queues
 
Message Queues and Drupal
Message Queues and DrupalMessage Queues and Drupal
Message Queues and Drupal
 
Life after the hack
Life after the hackLife after the hack
Life after the hack
 
Faster Drupal sites using Queue API
Faster Drupal sites using Queue APIFaster Drupal sites using Queue API
Faster Drupal sites using Queue API
 
Component Driven Development - DrupalCamp London 2017
Component Driven Development - DrupalCamp London 2017Component Driven Development - DrupalCamp London 2017
Component Driven Development - DrupalCamp London 2017
 
Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8Building rednoseday.com on Drupal 8
Building rednoseday.com on Drupal 8
 

Similar to Drupal Entities - Emerging Patterns of Usage

The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
Nate Abele
 
Drupal 7 Entity & Entity API
Drupal 7 Entity & Entity APIDrupal 7 Entity & Entity API
Drupal 7 Entity & Entity API
均民 戴
 
Drupal 8: Routing & More
Drupal 8: Routing & MoreDrupal 8: Routing & More
Drupal 8: Routing & More
drubb
 
Introducing CakeEntity
Introducing CakeEntityIntroducing CakeEntity
Introducing CakeEntity
Basuke Suzuki
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to know
Work at Play
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to know
katbailey
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entities
drubb
 
Laravel doctrine
Laravel doctrineLaravel doctrine
Laravel doctrine
Christian Nastasi
 
Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09
Michelangelo van Dam
 
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksLithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate Frameworks
Nate Abele
 
Magento Attributes - Fresh View
Magento Attributes - Fresh ViewMagento Attributes - Fresh View
Magento Attributes - Fresh ViewAlex Gotgelf
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
DrupalDay
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011camp_drupal_ua
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
Thomas Reynolds
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
Nate Abele
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
Alessandro Franceschi
 
Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)
brockboland
 
Drupal 8 Hooks
Drupal 8 HooksDrupal 8 Hooks
Intro to The PHP SPL
Intro to The PHP SPLIntro to The PHP SPL
Intro to The PHP SPL
Chris Tankersley
 

Similar to Drupal Entities - Emerging Patterns of Usage (20)

The State of Lithium
The State of LithiumThe State of Lithium
The State of Lithium
 
Drupal 7 Entity & Entity API
Drupal 7 Entity & Entity APIDrupal 7 Entity & Entity API
Drupal 7 Entity & Entity API
 
Drupal 8: Routing & More
Drupal 8: Routing & MoreDrupal 8: Routing & More
Drupal 8: Routing & More
 
Introducing CakeEntity
Introducing CakeEntityIntroducing CakeEntity
Introducing CakeEntity
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to know
 
JavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to knowJavaScript in Drupal 7: What developers need to know
JavaScript in Drupal 7: What developers need to know
 
Drupal 8: Entities
Drupal 8: EntitiesDrupal 8: Entities
Drupal 8: Entities
 
Laravel doctrine
Laravel doctrineLaravel doctrine
Laravel doctrine
 
Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09
 
Lithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate FrameworksLithium: The Framework for People Who Hate Frameworks
Lithium: The Framework for People Who Hate Frameworks
 
Magento Attributes - Fresh View
Magento Attributes - Fresh ViewMagento Attributes - Fresh View
Magento Attributes - Fresh View
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
Nickolay Shmalenuk.Render api eng.DrupalCamp Kyiv 2011
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Organizing Code with JavascriptMVC
Organizing Code with JavascriptMVCOrganizing Code with JavascriptMVC
Organizing Code with JavascriptMVC
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
 
Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)Drupal is Stupid (But I Love It Anyway)
Drupal is Stupid (But I Love It Anyway)
 
Drupal 8 Hooks
Drupal 8 HooksDrupal 8 Hooks
Drupal 8 Hooks
 
Intro to The PHP SPL
Intro to The PHP SPLIntro to The PHP SPL
Intro to The PHP SPL
 

Recently uploaded

Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 

Recently uploaded (20)

Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 

Drupal Entities - Emerging Patterns of Usage

  • 2. Code & Coders Entities - Emerging Patterns of Usage Presented by Ronald Ashri (ronald_istos) Wednesday, August 24, 11
  • 3. @ronald_istos Web App Development Travel / Semantic Web www.istos.it Solutions for hotels, villas, B&Bs drupalrooms.com w/ Bluespark Labs Drupal Trainer network drupalteachers.com w/ Brightlemon Wednesday, August 24, 11
  • 4. Building with Entities ✤ How we got to entities ✤ What do they look like, what can we do, what’s missing ✤ When and how should we use them ✤ Learning from how they are used so far ✤ Questions / Next Steps Wednesday, August 24, 11
  • 5. slice up a drupal and you will find nodes Wednesday, August 24, 11
  • 6. drupalistas love making lots of nodes and mixing them up in different ways ... much like pasta Wednesday, August 24, 11
  • 7. they love them so much they nearly turned everything into a node Wednesday, August 24, 11
  • 8. user pro les = drupal.org/project/content_pro le Wednesday, August 24, 11
  • 11. nodes come in different shapes but still tied to the same methods and db structure => need for a more generic core-based solution Wednesday, August 24, 11
  • 12. but the core development process is never simple Wednesday, August 24, 11
  • 13. Huge driver turned out to be the Field API work - attaching elds to core “stuff” came rst and the need to streamline followed Wednesday, August 24, 11
  • 14. “loadable thingies, that can be optionally eldable” (http://drupal.org/node/460320) Wednesday, August 24, 11
  • 16. Entities in Drupal 7 are the nodes we really wanted but didn’t know it yet The stuff / content that makes up our site nodes, users, taxonomy terms, comments, les User Node Taxonomy Term Comment Taxonomy File Vocabulary Wednesday, August 24, 11
  • 17. one day drupal will have a yeah... sure smallcore and it will all be OO Drupal Core Developers Summit 2040 Entities bring us closer to Drupal the framework No mention in UI - almost no mention in changelog Wednesday, August 24, 11
  • 18. CHANGELOG.TXT... “In addition, any other object type may register with Field API and allow custom data elds to be attached to itself.” object type = entity Wednesday, August 24, 11
  • 19. The relationships between Entities - the ways entities can interact with each other - de ne our Drupal application nodes can have comments users author nodes taxonomy terms are attached to nodes these relationships are implicit - perhaps they could be made explicit? Wednesday, August 24, 11
  • 20. how to cook - (or build entities) Wednesday, August 24, 11
  • 21. Your Table PostIt postit_id name property1 property2 property3 + elds (drupal worries about elds) Wednesday, August 24, 11
  • 22. you de ne an entity via a hook_entity_info (big array!): function postit_entity_info(){ $postit_info['postit'] = array( 'label' => t('PostIt Note'), 'controller class' => 'PostItController', 'base table' => 'postit', 'uri callback' => 'postit_uri', 'fieldable' => TRUE, 'entity keys' => array( 'id' => 'pid', ), 'static cache' => TRUE, 'bundles' => array( 'postit'=> array( 'label' => 'PostIt', 'admin' => array( 'path' => 'admin/structure/postit/manage', 'access arguments' => array('administer postits'), ), ), ), 'view modes' => array( 'full' => array( 'label' => t('Full PostIt'), 'custom settings' => FALSE, ), ) ); return $postit_info; } Wednesday, August 24, 11
  • 23. function postit_entity_info(){ $postit_info['postit'] = array( 'label' => t('PostIt Note'), 'controller class' => 'PostItController', 'base table' => 'postit', 'uri callback' => 'postit_uri', 'fieldable' => TRUE, You can provide you own controller class - typically 'entity keys' => array( 'id' => 'pid', ), extending the default DrupalDefaultEntityController 'static cache' => TRUE, which worries about caching, querying, revisioning and 'bundles' => array( 'postit'=> array( attaching elds to entities 'label' => 'PostIt', 'admin' => array( 'path' => 'admin/structure/postit/manage', 'access arguments' => array('administer postits'), ), ), ), 'view modes' => array( 'full' => array( 'label' => t('Full PostIt'), 'custom settings' => FALSE, ), ) ); return $postit_info; } Wednesday, August 24, 11
  • 24. function postit_entity_info(){ $postit_info['postit'] = array( 'label' => t('PostIt Note'), 'controller class' => 'PostItController', 'base table' => 'postit', 'uri callback' => 'postit_uri', 'fieldable' => TRUE, 'entity keys' => array( 'id' => 'pid', ), 'static cache' => TRUE, base table = where our main entity data lives 'bundles' => array( uri callback = where to look up - view entities 'postit'=> array( 'label' => 'PostIt', eldable = are elds to be attached to our entity 'admin' => array( 'path' => 'admin/structure/postit/manage', 'access arguments' => array('administer postits'), ), ), ), 'view modes' => array( 'full' => array( 'label' => t('Full PostIt'), 'custom settings' => FALSE, ), ) ); return $postit_info; } Wednesday, August 24, 11
  • 25. function postit_entity_info(){ $postit_info['postit'] = array( 'label' => t('PostIt Note'), 'controller class' => 'PostItController', 'base table' => 'postit', 'uri callback' => 'postit_uri', 'fieldable' => TRUE, 'entity keys' => array( 'id' => 'pid', ), 'static cache' => TRUE, 'bundles' => array( 'postit'=> array( 'label' => 'PostIt', 'admin' => array( 'path' => 'admin/structure/postit/manage', 'access arguments' => array('administer postits'), ), ), ), 'view modes' => array( 'full' => array( 'label' => t('Full PostIt'), Bundle = Entity + Con guration + Fields 'custom settings' => FALSE, ), ) 1 entity (Node) can have many bundles (Article, Page) ); return $postit_info; } Wednesday, August 24, 11
  • 26. tell drupal how to load your entity function postit_load($pid = NULL, $reset = FALSE){ $pids = (isset ($pid) ? array($pid) : array()); $postit = postit_load_multiple($pids, $reset); return $postit ? reset ($postit) : FALSE; } function postit_load_multiple($pids = array(), $conditions = array(), $reset = FALSE){ return entity_load('postit', $pids, $conditions, $reset); } function entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) { if ($reset) { entity_get_controller($entity_type)->resetCache(); } return entity_get_controller($entity_type)->load($ids, $conditions); } Wednesday, August 24, 11
  • 27. ready to cook! ✤ we also get a query API EntityFieldQuery ✤ conditions on properties and elds ✤ queries across entity types ✤ and we get hooks ✤ hook_entity_load() ✤ hook_entity_presave() ✤ hook_entity_insert() ✤ hook_entity_update() ✤ hook_entity_delete() ✤ hook_entity_prepare_view ✤ hook_entity_view() Wednesday, August 24, 11
  • 28. Young module developer : Where is full CRUD, UI, Views integration, Tokens, Search, etc? Drupal Core: What? Am I supposed to do everything around here? Wednesday, August 24, 11
  • 29. + Entity Module (drupal.org/project/entity) ✤ Supports full CRUD ✤ Quickly provide new entity types ✤ Standardised way of working with entity data ✤ Integration into drupal ecosystem (Tokens, Views, Rules, Exportables, Search API, RestWS, VBO) ✤ Full Tests Wednesday, August 24, 11
  • 30. so what are we cooking - and how? and why? Wednesday, August 24, 11
  • 31. entities are a uniquely drupaly concept your stuff (your db table or something like that) + Field API + hooks in the drupal world Wednesday, August 24, 11
  • 32. if your module / app is introducing data you should really be asking yourself why not via entities you get plugged in to the drupal world for (almost) zero cost and your data can remains as is (almost) Wednesday, August 24, 11
  • 34. Commerce ✤ Great example as there is also historical perspective ✤ D6 Ubercart did almost everything “outside” of Drupal ✤ D7 Commerce is a fully signed up member to the Drupal ecosystem Wednesday, August 24, 11
  • 35. in order to add commerce capabilities we need to introduce a whole set of concepts (and their supporting data structures) Drupal Commerce de nes Customer Pro les Lines Items Orders Payment Transactions Products as entities Wednesday, August 24, 11
  • 36. Drupal Commerce defines only as much as it needs in terms of fields attached to these entities - Application core concepts (e.g. sku for product) live in entity base table not via field More complex core data (e.g. price) gets added via a locked field Allows the user add extra fields where it makes sense Wednesday, August 24, 11
  • 37. local action entity types Entity operational links Listing as a View Wednesday, August 24, 11
  • 38. Contains Line Order Entity Item Entities Related to payment entities address eld eld looks familiar! Wednesday, August 24, 11
  • 39. use entities to introduce new data types that can be user-extensible provide minimum conf required - easily customisable in install profiles or via custom modules ps: did I mention - you really, really, really need a good reason not to use entities when introducing new data (and data tables) to Drupal Wednesday, August 24, 11
  • 40. Profile 2 ✤ Separates users from descriptions of users ✤ Uses different bundles to describe different aspects of the same user ✤ Use entities to provide pro le level type permissions Wednesday, August 24, 11
  • 41. placed under Entity Module UI admin/structure for handling types per type con guration Wednesday, August 24, 11
  • 42. use new entity relationships to extend the application provide configuration via entity types Wednesday, August 24, 11
  • 43. Organic Groups ✤ Organic Groups uses Entities because via the Entity API it gets CRUD, Views, Rules integration etc for free ✤ Groups are still attached to nodes ✤ Automatically created via an indirect user action Wednesday, August 24, 11
  • 44. Group Entity when you create a node as a Group Type this triggers the creation of the Group Entity separation of concerns opens up interesting possibilities and enables things that were not possible before like better internationalization support Wednesday, August 24, 11
  • 45. Group Membership Entity content group Wednesday, August 24, 11
  • 46. because relationships are entities we can add elds to them e.g. date eld indicating relationship expiration Wednesday, August 24, 11
  • 47. use Entities to separate concerns - using the Field API as a way to exibly add access to con guration options - Site builder can decide how much con g to make available to Site Admins Wednesday, August 24, 11
  • 48. Rooms ✤ Hotel booking application ✤ Introduces Bookable Units and Bookings as entities ✤ Relates entities to non entify-able data ✤ Uses entity types for default values settings as well as a source of common data across all entities instances Wednesday, August 24, 11
  • 51. Entity Types de ne default property values Wednesday, August 24, 11
  • 52. Rooms interact via entities Commerce Wednesday, August 24, 11
  • 53. Kickstarting Development entities in a jar Wednesday, August 24, 11
  • 54. Model Entities drupal.org/project/model Implementation of a generic Entity and Entity Administration interface that you can use to kickstart your own project. Wednesday, August 24, 11
  • 55. experiment and learn from others doing it your way is great... but also need to study and share patterns for doing things Wednesday, August 24, 11
  • 56. Summary ✤ Drupalize your data with entities ✤ Improves distinction between drupal the framework and drupal the CMS impoving app development ✤ Leverage the entity module ✤ Learn from examples Wednesday, August 24, 11
  • 57. @ronald_istos Web App Development Travel / Semantic Web www.istos.it Solutions for hotels, villas, B&Bs drupalrooms.com w/ Bluespark Labs Drupal Trainer network drupalteachers.com w/ Brightlemon Wednesday, August 24, 11
  • 58. What did you think? Locate this session on the DrupalCon London website: http://london2011.drupal.org/conference/schedule Click the “Take the survey” link THANK YOU! Wednesday, August 24, 11