Drupal 7 development: first impressions <ul><li>Dennis Povshedny, madcap.nl </li></ul>
Minor stuff <ul><li>Like different *.info files format (dependencies[]) </li></ul>
API somewhere changed <ul><li>As well as for D5 to D6 migration </li></ul><ul><li>Versions </li></ul><ul><li>4.6 hook_form...
Registry introduced <ul><li>Two tables in DB to hold all registered functions </li></ul><ul><li>kind of OOP based on proce...
DB is now object oriented, baby! <ul><li>No more good old db_query; </li></ul><ul><li>Use PDO (PHP Data Objects) instead; ...
D6 way <ul><li>$entry = db_query('SELECT parent_nid FROM {ts_activity_hierarchy} WHERE ts_activity_hierarchy.nid = ' . $ni...
D7 way <ul><li>$query = db_select('ts_activity_hierarchy');   $query->addField('ts_activity_hierarchy',  'parent_nid' );  ...
Translate, please! <ul><li>$num_revoked = db_delete('ts_activity_users')   ->condition('activity_nid', $nid)   ->condition...
DB: guard pattern <ul><li>{   $guard = db_transaction();   ... } </li></ul>
Beautiful doc for deal with DB hell <ul><li>http://drupal.kollm.org/doxygen/drupal-phpdoc/class_select_query.html </li></ul>
 
How stable is UNSTABLE? <ul><li>Now we use UNSTABLE 9 even node_ tables has changed recently </li></ul><ul><li>Shall I sta...
Other good practices <ul><li>Write Doxygen - style comments; </li></ul><ul><li>Enjoy pure PHP5 cause PHP4 is no longer sup...
Thank you! <ul><li>Questions and ideas – welcome! </li></ul><ul><li>Drupal 7 – just try it! :) </li></ul>
Upcoming SlideShare
Loading in...5
×

D7dev

592

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
592
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

D7dev

  1. 1. Drupal 7 development: first impressions <ul><li>Dennis Povshedny, madcap.nl </li></ul>
  2. 2. Minor stuff <ul><li>Like different *.info files format (dependencies[]) </li></ul>
  3. 3. API somewhere changed <ul><li>As well as for D5 to D6 migration </li></ul><ul><li>Versions </li></ul><ul><li>4.6 hook_form(&$node, &$param) </li></ul><ul><li>4.7 hook_form(&$node) </li></ul><ul><li>5 hook_form(&$node, $form_values) </li></ul><ul><li>6 hook_form(&$node, $form_state) </li></ul><ul><li>7 hook_form($node, $form_state) </li></ul>
  4. 4. Registry introduced <ul><li>Two tables in DB to hold all registered functions </li></ul><ul><li>kind of OOP based on procedural platform </li></ul><ul><li>Rebuild registry regularly with clearing cache, like: - call drupal_flush_all_caches() - truncate all cache_* tables </li></ul>
  5. 5. DB is now object oriented, baby! <ul><li>No more good old db_query; </li></ul><ul><li>Use PDO (PHP Data Objects) instead; </li></ul><ul><li>Looks like a hell at a first sight </li></ul>
  6. 6. D6 way <ul><li>$entry = db_query('SELECT parent_nid FROM {ts_activity_hierarchy} WHERE ts_activity_hierarchy.nid = ' . $nid); </li></ul>
  7. 7. D7 way <ul><li>$query = db_select('ts_activity_hierarchy'); $query->addField('ts_activity_hierarchy', 'parent_nid' ); $query->condition('ts_activity_hierarchy.nid', $nid); $result = $query->execute(); $entry = db_fetch_object($result); </li></ul>
  8. 8. Translate, please! <ul><li>$num_revoked = db_delete('ts_activity_users') ->condition('activity_nid', $nid) ->condition('uid', $userid, 'IN') ->execute(); </li></ul><ul><li>db_query('DELETE FROM {ts_activity_users} WHERE activity_nid=' . $nid . ' AND uid IN (' . implode(',', $userid) . ')'); </li></ul>
  9. 9. DB: guard pattern <ul><li>{ $guard = db_transaction(); ... } </li></ul>
  10. 10. Beautiful doc for deal with DB hell <ul><li>http://drupal.kollm.org/doxygen/drupal-phpdoc/class_select_query.html </li></ul>
  11. 12. How stable is UNSTABLE? <ul><li>Now we use UNSTABLE 9 even node_ tables has changed recently </li></ul><ul><li>Shall I start or wait? </li></ul>
  12. 13. Other good practices <ul><li>Write Doxygen - style comments; </li></ul><ul><li>Enjoy pure PHP5 cause PHP4 is no longer supported – feel free to use 'clone', etc </li></ul><ul><li>... </li></ul>
  13. 14. Thank you! <ul><li>Questions and ideas – welcome! </li></ul><ul><li>Drupal 7 – just try it! :) </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×