37
Parent / Child Parent / Child Data Modeling Data Modeling 1

Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Embed Size (px)

Citation preview

Page 1: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Parent / ChildParent / Child Data Modeling Data Modeling

1

Page 2: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

2

Dennis SolisDennis Solis

Solis Media GroupSolis Media Group Over 20 years of application software Over 20 years of application software

development.development. 3 years of Drupal development3 years of Drupal development Mentor: Drupal Career Starter ProgramMentor: Drupal Career Starter Program Presented a multiple Drupal CampsPresented a multiple Drupal Camps d.o. : densolisd.o. : densolis irc: #drupal-florida irc: #drupal-florida skype: densolis.aol.comskype: densolis.aol.com

Page 3: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

 Dennis Solis

 Born and raised in SFBorn and raised in SF

3

Page 4: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

 Dennis Solis

 Born and raised in SFBorn and raised in SF

4

Living in Cocoa, Living in Cocoa, FlFl

Page 5: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

What is Parent ChildWhat is Parent ChildData Modeling?Data Modeling?

Example 1 – Edit Event

5

Page 6: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

What is Parent ChildWhat is Parent ChildData ModelingData Modeling

A “different” way of looking at your data.

Visualize how content is related

Relate a node to a nodeNo code and no custom entities

6

Page 7: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

How is Parent ChildHow is Parent ChildData Modeling Different?Data Modeling Different?Drupal normal approach is:

Independent content typesTaxonomiesAnd maybe entity references.

Use of the content listNot really user friendly

7

Page 8: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Why change?Why change?

Provides a more “natural” UIAdd a dashboard, which provide easy UI

No longer use the content list!No code and no custom entities

8

Page 9: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

PC RelationshipsPC RelationshipsModulesModules

Entity Api entityEntity Reference entityreference Entity Connect entityconnectView viewsEntity Ref Views Widgetentityreference_view_widgetAuto Entity Label auto_entitylabel

9

Page 10: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Drupal Camp PC Data Drupal Camp PC Data ModelModel

10

What data do we need for a Drupal What data do we need for a Drupal Camp?Camp?

Page 11: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Drupal Camp Data ModelDrupal Camp Data Model

11

What data do we need for a Drupal What data do we need for a Drupal Camp?Camp? EventEvent VenueVenue Time slotsTime slots SponsorsSponsors Featured Featured

SpeakersSpeakers DescriptionDescription

NewsNews RoomsRooms SessionsSessions Session Session

SpeakersSpeakers Event typeEvent type

Page 12: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Drupal Camp Data ModelDrupal Camp Data Model

12

12 Content types / taxonomies12 Content types / taxonomies Traditional approach – 12 different Traditional approach – 12 different

menusmenus What is the training curve for a end What is the training curve for a end

user?user?

Page 13: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Drupal Content for DCDrupal Content for DC

13

EventDrupal Camp

NewsFeaturedSpeakers

Sponsors

Time Slots

Venue

ScheduleUsers /

SpeakersSessions

Rooms

Page 14: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Drupal Camp Data ModelDrupal Camp Data Model

14

New employee – first day on the job, New employee – first day on the job, you ask them to enter the Drupal camp you ask them to enter the Drupal camp schedule.schedule.

They have to go to multiple menu They have to go to multiple menu options and enter theoptions and enter the Time slotsTime slots RoomsRooms Experience levelExperience level And the associate Sessions and Speaker And the associate Sessions and Speaker

with the time slot / room.with the time slot / room.

Page 15: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

DC Parent Child Data DC Parent Child Data ModelModel

15

The PCDM looks at these items very The PCDM looks at these items very different.different.

This approach is VERY USER CENTRICThis approach is VERY USER CENTRIC Users can access everything from 1 main Users can access everything from 1 main

form!form!

Reduces user training because the data Reduces user training because the data entry process is intuitive.entry process is intuitive.

And views run very fast because And views run very fast because everything is direct access.everything is direct access.

Page 16: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

DC Parent Child Data DC Parent Child Data ModelModel

16

EventDrupal Camp

Page 17: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

DC Parent Child Data DC Parent Child Data ModelModel

17

EventDrupal Camp

News FeaturedSpeakers

SponsorsTime Slots

Venue Schedule

Page 18: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

DC Parent Child Data DC Parent Child Data ModelModel

18

EventDrupal Camp

News FeaturedSpeakers

SponsorsTime Slots

Venue Schedule

Users / Speakers

Page 19: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

DC Parent Child Data DC Parent Child Data ModelModel

19

EventDrupal Camp

News FeaturedSpeakers

SponsorsTime Slots

Venue Schedule

Users / Speakers

Sessions

Rooms

Page 20: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

DC Parent Child Data DC Parent Child Data ModelModel

20

EventDrupal Camp

News FeaturedSpeakers

SponsorsTime Slots

Venue Schedule

Users / Speakers

Sessions

Rooms

Page 21: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Simple UI

Everything, except creation of sessions, is accessed from the Event.

You only need on menu option for the Event!

Simplify it even more that creating a dashboard that is automatically presented at login.

21

Page 22: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Content Types

Create your content from the bottom up. Lowest content in the parent child relation

ship first. Have the parent reference the child

using entity relationship. We will “connect” the different content

types using: Entity Connect Entity view widgets

22

Page 23: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

3 Parts to aRelationship

Create relationship using entity reference in your content types.

Use entity connect to put edit / add icons on your page.

Use views to display the related data.

23

Page 24: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Step 1Create Entity Reference

Example 2 Edit the structure of the Event Admin -> Structure -> Content Type ->

Manage Field -> Event Look at the Venue field

24

Page 25: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Step 2Entity Connect

Example 2 Edit the structure of the Event Admin -> Structure -> Content Type ->

Manage Field -> Event Look at the Venue field

25

Page 26: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Step 3 Step 3 Views - Add relationshipsViews - Add relationships Views – Add relationship Referenced

Read child from the parent or Down from parent to child

Referencing Read the parent from the chile or Up to Parent from the child

26

Page 27: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Step 3 Step 3 Views - Add relationshipsViews - Add relationships Example 3 – View DC Sessions

Referenced – Read entity referenced from source View is based upon Event and reading

Session’s Date / Time, Title, and Presenters

27

Page 28: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Step 3 Step 3 Views - Add relationshipsViews - Add relationships Example 4 – View Event Sessions

Referenced – Read entity referenced from source View is based upon Event Contextual

Filter and reading Session’s Date / Time, Title, and Presenters

28

Page 29: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Views conditionals

module: views_conditionalmodule: views_conditional

You want to check some condition before you decided to the field should be displayed.

In my case, I check a person’s role before decide if they have the permissions to see a specific field..

ExampleExample29

Page 30: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

ViewsViewsAdd relationshipsAdd relationships

Views – Add relationship (Example 4) Referenced – Read entity referenced from

source. (Down from parent to child) View is based upon Customer Order and

reading Staff, and Dish information Referencing – Read up to source from

entity reference. (Up from child to parent) View is based upon Staff and reading

Customer Order information.

30

Page 31: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Univ. of Hard Knocks Univ. of Hard Knocks Suggestions for ViewsSuggestions for Views

Include node type in field name Easily find field in views list of fields.

31

Page 32: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

UHK Suggestions for UHK Suggestions for ViewsViews

Name content types in singularName content types in singular Names views in pluralNames views in plural

If you name content type and If you name content type and view the same, then views hangsview the same, then views hangs

32

Page 33: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

UHK Suggestions for UHK Suggestions for ViewsViews

If using multiple views:If using multiple views: ““All displays” vs “this page”All displays” vs “this page”

Structure -> Views -> SettingsStructure -> Views -> Settings Show the SQL queryShow the SQL query

33

Page 34: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

UHK Suggestions for UHK Suggestions for ViewsViews

Make input required BEFORE views Make input required BEFORE views runs.runs.

34

Page 35: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

UHK Suggestions for UHK Suggestions for ViewsViews

Page views with same path.Page views with same path. Bad – only one view will appear in the Bad – only one view will appear in the

menumenu Good – if the different views have Good – if the different views have

different role permission, you can have different role permission, you can have multiple views under one menu item – multiple views under one menu item – and role appropriate view will appear.and role appropriate view will appear.

35

Page 36: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

UHK Suggestions for UHK Suggestions for ViewsViews

Don’t forget to put in No Results Don’t forget to put in No Results message in your view.message in your view.

36

Page 37: Parent / Child Data Modeling 1. 2 Dennis Solis Solis Media Group Solis Media Group Over 20 years of application software development. Over 20 years of

Congratulation!Congratulation!You are now an Parent Child Expert!You are now an Parent Child Expert!

37