SlideShare a Scribd company logo
1 of 19
Download to read offline
Drupal 7 Entities
                              DrupalCamp Helsinki
                                   27.9.2011

                                 Tomi Mikola

business of open technology
About me
 • Working at Mearra
 • Architect, senior developer, project
       mgr, salesman, co-founder, Drupal
       evangelist
 • Drupal as the primary platform since
       2006

business of open technology
What are entities?
business of open technology
Concept of Entity
 • Generalization of something that can
       be stored in Drupal
 • Standardized set of how data
       structures are represented
 • In D6 nodes were considered as the
       main abstraction point

business of open technology
Concept of Entity
 • Type of objects which Drupal is
       aware of
 • Something unique, relevant to the
       application
 • "The new Node"
 • D7: Nodes, Users, Files, Comments,
       Terms, ...
business of open technology
Fields and entities
business of open technology
Fields

 • Data types which can be attached to
       any kind of entity
 • Widgets & formatters
 • Field instances

business of open technology
Bundles

 • Entity + field (*n) = Bundle
 • Node (entity), Article (bundle)
 • User (entity), User (bundle)

business of open technology
business of open technology   Entity API
Entity API

 • Contrib module (drupal.org/project/entity)
 • Completes what Drupal core entities
       should be
 • Full CRUD operations

business of open technology
business of open technology   Entity?
Entities or Nodes?

 • “I created a draft using Word”
 • Translations, versioning?
 • End-user’s point of view: “Content!”

business of open technology
How to begin?
business of open technology
How to begin with entities?
 • No UI
 • Write code
        •      hook_schema()
        •      hook_entity_info()
                •     Label
                •     Base table
                •     Fieldable
business of open technology
How to begin with entities?
  function node_entity_info() {
    $return = array(
      'node' => array(
        'label' => t('Node'),
        'controller class' => 'NodeController',
        'base table' => 'node',
        'revision table' => 'node_revision',
        'uri callback' => 'node_uri',
        'fieldable' => TRUE,
        'entity keys' => array(
           'id' => 'nid',
           'revision' => 'vid',
           'bundle' => 'type',
           'label' => 'title',
        ),
        'bundles' => array(),
        //...


business of open technology
business of open technology   Prove it!
Poll Improved (demo)

 • Drupal core Poll doesn’t take
       advantage of entities
 • Started new project to test Entity API
 • Model (contrib module) as basis
 • Flexibility by using Field API
business of open technology
Thank you!




business of open technology
business of open technology




                              Photos © Tomi Mikola

More Related Content

Similar to D7 Entities

Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...Neo4j
 
Drupal 8 introduction
Drupal 8 introductionDrupal 8 introduction
Drupal 8 introductionAditya Ghan
 
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OW2
 
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OCCIware
 
Keynote at Converge 2019
Keynote at Converge 2019Keynote at Converge 2019
Keynote at Converge 2019Travis Oliphant
 
The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...
The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...
The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...The Internet of Things Methodology
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPChris Renner
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandAngela Byron
 
Done in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyDone in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyRoel Hartman
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical MementoOdoo
 
Web Components and Polymer at Nuxeo - Building our New Web UI
Web Components and Polymer at Nuxeo - Building our New Web UIWeb Components and Polymer at Nuxeo - Building our New Web UI
Web Components and Polymer at Nuxeo - Building our New Web UINuxeo
 
Software Development: Beyond Training wheels
Software Development: Beyond Training wheelsSoftware Development: Beyond Training wheels
Software Development: Beyond Training wheelsNaveenkumar Muguda
 
Building a Startup in .NET
Building a Startup in .NETBuilding a Startup in .NET
Building a Startup in .NETMarcelo Calbucci
 
Developing Modeling Tool for RM-ODP with Eclipse Sirius
Developing Modeling Tool for RM-ODP with Eclipse SiriusDeveloping Modeling Tool for RM-ODP with Eclipse Sirius
Developing Modeling Tool for RM-ODP with Eclipse SiriusObeo
 
Eclipse workshop presentation
Eclipse workshop presentationEclipse workshop presentation
Eclipse workshop presentationMiguel Pardal
 

Similar to D7 Entities (20)

Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
Neo4j Innovation Lab – Bringing the Best of Data Science and Design Thinking ...
 
Drupal 8 introduction
Drupal 8 introductionDrupal 8 introduction
Drupal 8 introduction
 
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
 
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
OCCIware, a formal framework for Everything as a Service. OW2con'15, November...
 
The Developers World
The Developers WorldThe Developers World
The Developers World
 
A Methodology for Building the Internet of Things
A Methodology for Building the Internet of ThingsA Methodology for Building the Internet of Things
A Methodology for Building the Internet of Things
 
Keynote at Converge 2019
Keynote at Converge 2019Keynote at Converge 2019
Keynote at Converge 2019
 
5. open innov ict-platf
5. open innov ict-platf5. open innov ict-platf
5. open innov ict-platf
 
VSTO
VSTOVSTO
VSTO
 
The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...
The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...
The IoT Methodology & An Introduction to the Intel Galileo, Edison and SmartL...
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
 
Drupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the islandDrupal 8: A story of growing up and getting off the island
Drupal 8: A story of growing up and getting off the island
 
Done in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyDone in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easy
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
 
Web Components and Polymer at Nuxeo - Building our New Web UI
Web Components and Polymer at Nuxeo - Building our New Web UIWeb Components and Polymer at Nuxeo - Building our New Web UI
Web Components and Polymer at Nuxeo - Building our New Web UI
 
Software Development: Beyond Training wheels
Software Development: Beyond Training wheelsSoftware Development: Beyond Training wheels
Software Development: Beyond Training wheels
 
Session 2
Session 2Session 2
Session 2
 
Building a Startup in .NET
Building a Startup in .NETBuilding a Startup in .NET
Building a Startup in .NET
 
Developing Modeling Tool for RM-ODP with Eclipse Sirius
Developing Modeling Tool for RM-ODP with Eclipse SiriusDeveloping Modeling Tool for RM-ODP with Eclipse Sirius
Developing Modeling Tool for RM-ODP with Eclipse Sirius
 
Eclipse workshop presentation
Eclipse workshop presentationEclipse workshop presentation
Eclipse workshop presentation
 

Recently uploaded

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Recently uploaded (20)

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

D7 Entities

  • 1. Drupal 7 Entities DrupalCamp Helsinki 27.9.2011 Tomi Mikola business of open technology
  • 2. About me • Working at Mearra • Architect, senior developer, project mgr, salesman, co-founder, Drupal evangelist • Drupal as the primary platform since 2006 business of open technology
  • 3. What are entities? business of open technology
  • 4. Concept of Entity • Generalization of something that can be stored in Drupal • Standardized set of how data structures are represented • In D6 nodes were considered as the main abstraction point business of open technology
  • 5. Concept of Entity • Type of objects which Drupal is aware of • Something unique, relevant to the application • "The new Node" • D7: Nodes, Users, Files, Comments, Terms, ... business of open technology
  • 6. Fields and entities business of open technology
  • 7. Fields • Data types which can be attached to any kind of entity • Widgets & formatters • Field instances business of open technology
  • 8. Bundles • Entity + field (*n) = Bundle • Node (entity), Article (bundle) • User (entity), User (bundle) business of open technology
  • 9. business of open technology Entity API
  • 10. Entity API • Contrib module (drupal.org/project/entity) • Completes what Drupal core entities should be • Full CRUD operations business of open technology
  • 11. business of open technology Entity?
  • 12. Entities or Nodes? • “I created a draft using Word” • Translations, versioning? • End-user’s point of view: “Content!” business of open technology
  • 13. How to begin? business of open technology
  • 14. How to begin with entities? • No UI • Write code • hook_schema() • hook_entity_info() • Label • Base table • Fieldable business of open technology
  • 15. How to begin with entities? function node_entity_info() { $return = array( 'node' => array( 'label' => t('Node'), 'controller class' => 'NodeController', 'base table' => 'node', 'revision table' => 'node_revision', 'uri callback' => 'node_uri', 'fieldable' => TRUE, 'entity keys' => array( 'id' => 'nid', 'revision' => 'vid', 'bundle' => 'type', 'label' => 'title', ), 'bundles' => array(), //... business of open technology
  • 16. business of open technology Prove it!
  • 17. Poll Improved (demo) • Drupal core Poll doesn’t take advantage of entities • Started new project to test Entity API • Model (contrib module) as basis • Flexibility by using Field API business of open technology
  • 18. Thank you! business of open technology
  • 19. business of open technology Photos © Tomi Mikola