• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Zend Framework Study@Tokyo #2
 

Zend Framework Study@Tokyo #2

on

  • 3,099 views

Zend Framework Study@Tokyo#2

Zend Framework Study@Tokyo#2

Statistics

Views

Total Views
3,099
Views on SlideShare
2,913
Embed Views
186

Actions

Likes
2
Downloads
22
Comments
0

4 Embeds 186

http://d.hatena.ne.jp 176
http://www.slideshare.net 8
http://asklife.info 1
http://webcache.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Zend Framework Study@Tokyo #2 Zend Framework Study@Tokyo #2 Presentation Transcript

  • 2010/03/06 id:heavenshell
  • wozozo …
  • id:heavenshell (3/6 ) http://d.hatena.ne.jp/heavenshell http://twitter.com/heavenshell http://github.com/heavenshell http://openpear.org/maintainer/heavenshell Java (Cubby ) Python, JavaScript, Vim
  • 2007 ( ) (PEAR::Pager ) → Phwittr Ver1.5 Ver1.8 Zend_Application
  • Zend_Application (2009/10) 1.10
  • Zend_Application (2009/10) 1.10
  • Doctrine Doctrine Doctrine … ←
  • ASP ( ) CRUD cron (JavaScript) API
  • Zend Framework 1.9x http://github.com/heavenshell/gene Zend_Db, Revulo_View_Phtmlc Doctrine Twig Github web-app-theme http://github.com/pilu/web-app-theme
  • app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models | |-- Tables | `-- Tables.php |-- modules | |-- admin | |-- api | `-- index |-- plugins | `-- Gene |-- services `-- views `-- scripts
  • app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules | |-- admin | |-- api | `-- index |-- plugins | `-- Gene |-- services `-- views `-- scripts
  • app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules Zend_Controller | |-- admin | |-- api | `-- index |-- plugins | `-- Gene |-- services `-- views `-- scripts
  • app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules Zend_Controller | |-- admin | |-- api | `-- index |-- plugins | `-- Gene ( ) |-- services `-- views `-- scripts
  • app |-- Gene.php |-- config |-- layouts | |-- admin | `-- index |-- locales | `-- ja |-- models Zend_Db ( Dao) | |-- Tables | `-- Tables.php |-- modules Zend_Controller | |-- admin | |-- api | `-- index |-- plugins | `-- Gene ( ) |-- services `-- views `-- scripts
  • modules application
  • Plugin Zend_Controller_Plugin_Abstract ( ) CSRF ○○
  • Zend_Auth::getInstance()->getIdentity();
  • Q4M Openpear::Net_Q4M … Zend_Queue Zend_Queue_Adapter_Q4m
  • 1.7x Zend Framework use-at-will DB, View, Session, Routing, etc
  • 1.8 Zend_Application Dependency Injection noopable 1.7
  • Storefront (http://www.thepopeisdead.com/) Zend_Application zfdebugdoctrine (http://github.com/danceric/zfdebugdoctrine) ZFDebug Doctrine
  • Magento (http://www.magentocommerce.com/) OSS EC Live Commerce (http://www.live-commerce.com/) OSS TomatoCMS (http://tomatocms.com/) OSS CMS
  • Zend_Application_Bootstrap_Bootstrap application.ini ini application/ Bootstrap.php
  • Zend_Application_Bootstrap_Bootstrap [application.ini] bootstrap.path = GENE_LIB_PATH "/Bootstrap.php" bootstrap.class = "Gene_Bootstrap" application.ini ↓ ini bootstrap.path = GENE_APP_PATH "/Phwitter.php" application/ bootstrap.class = "Phwittr" Bootstrap.php
  • ( junichiro ) Zend_Db, Doctrine ( Zend_Db) View (ry Zend_Log Zend_Cache
  • Validation Zend_Filter_Input (Zend_Form ) Zend_Translate
  • FW ini Zend_Translate
  • $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid()); array(1) { ["name"]=> array(1) { ["stringLengthTooLong"]=> string(42) " 10 " }
  • $requests = array('name' => 'hogehogehoge'); $validations = array( 'name' => array( new Zend_Validate_StringLength(1, 10, 'utf-8'), 'messages' => array( 0 => $translate->_('User name should enter less than 100.'), ) ) ); Zend_Translate $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid()); array(1) { ["name"]=> array(1) { ["stringLengthTooLong"]=> string(42) " 10 " }
  • $requests = array('email' => 'example@example.c'); $validations = array( 'email' => array( new Zend_Validate_EmailAddress(), 'messages' => array( 0 => $translate->_('Email is invaild.'), ) ) ) ); $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • $requests = array('email' => 'example@example.c'); $validations = array( 'email' => array( new Zend_Validate_EmailAddress(), 'messages' => array( 0 => $translate->_('Email is invaild.'), ) ) ) ); $validator = new Zend_Filter_Input(null, $validation); $valid = $validator->setData($requests)->isValid(); var_dump($input->getInvalid());
  • array(1) { ["email"]=> array(1) { ["emailAddressInvalidHostname"]=> string(26) " " } }
  • array(1) { ["email"]=> array(1) { ["emailAddressInvalidHostname"]=> string(26) " " } }
  • _ | ∪ __ __ J| _ u ´ || | || | ● | ∪ __ __ J| _ u ´ || | || |
  • array(1) { ["email"]=> array(3) { ["emailAddressInvalidHostname"]=> string(70) "'example.c' is no valid hostname for email address 'example@example.c'" ["hostnameUndecipherableTld"]=> string(68) "'example.c' appears to be a DNS hostname but cannot extract TLD part" ["hostnameLocalNameNotAllowed"]=> string(86) "'example.c' appears to be a local network name but local network names are not allowed" } }
  • :::::: :::::::: ○ ○ |:::::::::::::::::::: __ __ :::: | _ ::::::::: |r -| || | :::::::::::: ` '´ || |
  • :::::: :::::::: ○ ○ |:::::::::::::::::::: __ __ :::: | _ ::::::::: |r -| || | :::::::::::: ` '´ || |
  • Zend_Validation_EmailAddress
  • Zend_Translate translate Zend_Validate_Abstract Zend_Validate_Abstract::setDefaultTranslator($transla te);
  • 1.9x, 1.10x http://github.com/heavenshell/gene/blob/0.2/app/ locales/ja/validate.ini http://github.com/heavenshell/zf-resources-lang-ja/ blob/master/Zend_Validate.php typo <(_ _)>
  • [Ver1.9x] $locale = new Zend_Locale(); $path = '/path/to/ja/file.ini'; $translate = new Zend_Translate('ini', $path, $locale); Zend_Validate_Abstract::setDefaultTranslator($translate); [Ver1.10x] $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); Zend_Validate_Abstract::setDefaultTranslator($translate);
  • [Ver1.9x] $locale = new Zend_Locale(); $path = '/path/to/ja/file.ini'; $translate = new Zend_Translate('ini', $path, $locale); Zend_Validate_Abstract::setDefaultTranslator($translate); [Ver1.10x] array() $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); Zend_Validate_Abstract::setDefaultTranslator($translate);
  • → ( )
  • trunk
  • " '%value%' '%hostname%' " Zend_Validate.php Zend_Translate#addTranslation()
  • return array( ''%hostname%' is no valid hostname for email address '%value%'' => ' ///' ); $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); $anotherpath = '/path/to/resources/languages' . $lang . '/Another.php'; $translate->addTranslation($anotherpath); Zend_Validate_Abstract::setDefaultTranslator($translate); array(3) { ["emailAddressInvalidHostname"]=> string(72) " ///" ["hostnameUndecipherableTld"]=> string(82) "'examlpe.c' DNS TLD " ["hostnameLocalNameNotAllowed"]=> string(126) " 'examle.c' " }
  • return array( ''%hostname%' is no valid hostname for email address '%value%'' => ' ///' ); $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); $anotherpath = '/path/to/resources/languages' . $lang . '/Another.php'; $translate->addTranslation($anotherpath); Zend_Validate_Abstract::setDefaultTranslator($translate); array(3) { ["emailAddressInvalidHostname"]=> string(72) " ///" ["hostnameUndecipherableTld"]=> string(82) "'examlpe.c' DNS TLD " ["hostnameLocalNameNotAllowed"]=> string(126) " 'examle.c' " }
  • return array( ''%hostname%' is no valid hostname for email address '%value%'' => ' ///' ); $locale = new Zend_Locale(); $path = '/path/to/resources/languages'; $scan = array('scan' => Zend_Translate::LOCALE_DIRECTORY); $translate = new Zend_Translate('array', $path, $locale, $scan); $anotherpath = '/path/to/resources/languages' . $lang . '/Another.php'; $translate->addTranslation($anotherpath); Zend_Validate_Abstract::setDefaultTranslator($translate); array(3) { ["emailAddressInvalidHostname"]=> string(72) " ///" ["hostnameUndecipherableTld"]=> string(82) "'examlpe.c' DNS TLD " ["hostnameLocalNameNotAllowed"]=> string(126) " 'examle.c' " }
  • CRUD → → x( + )x Scafford
  • FW TDD
  • PHPUnit Stagehand_Testrunner … …
  • CRUD → → x( + ) DB FW ( ) …
  • Zend Framework Zend_Application Zend_Translate ( )
  • Any questions?