My Development Story

11,446 views

Published on

CakePHP温泉部でのスライド
CakePHPの継承/Amazon API活用/テストケース等について簡単に。

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

  • Be the first to like this

No Downloads
Views
Total views
11,446
On SlideShare
0
From Embeds
0
Number of Embeds
6,304
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • My Development Story

    1. 1. CakePHP + My Development Story Takahiro Fujiwara @tfmagician
    2. 2. Amazon …
    3. 3. / github CakePHP Amazon A2S( ECS4.0) Amazon-eCommerce-datasource github ”cake amazon”
    4. 4. ...
    5. 5. XML CD/ / (Author/Artist),(Title), (Releasedate/Publicationdate) / /
    6. 6. extends libs AppController shell controller $jenreID/$subJenreID
    7. 7. Sample Extends 1 <?php 2 App::import('Controller', 'libs/author_checks'); 3 4 class CdArtistChecksController extends AuthorChecksController { 5 var $name = 'CdArtistChecks'; 6 var $jenreID = 'Cd'; 7 var $subJenreID = 'Artist'; 8} 9 ?>
    8. 8. Sample Extends <?php 2 class AuthorChecksController extends AppController { 3 var $helpers = array('Html', 'Form'); 4 var $paginate = array( 5 'AuthorCheck' => array( 6 'limit' => 10, 7 'conditions' => array('deleted' => 0), 8 'order' => array('created' => 'asc'), 9 'contain' => false, 10 'with' => 'suggests')); 11 12 function __construct() { 13 $this->jenreID = Inflector::Camelize($this->jenreID); 14 $this->subJenreID = Inflector::Camelize($this->subJenreID); 15 $this->prefix = $this->jenreID.$this->subJenreID;
    9. 9. controller shell
    10. 10. GUI (Controller ) CUI (Shell )
    11. 11. ...
    12. 12. controller + shell = Spaghetti
    13. 13. VMC VMC ... Model ...
    14. 14. ...
    15. 15. Controller/Shell ...
    16. 16. ClassRegistory::init constructor ClassRegistory::init
    17. 17. Sample ClassRegistory 1 <?php 2 class AuthorModel extends AppModel { 3 function __construct($id = false, $table = NULL, $ds = NULL){ 4 $this->jenreID = Inflector::Camelize($this->jenreID); 5 $this->subJenreID = Inflector::Camelize($this->subJenreID); 6 $this->prefix = $this->jenreID.$this->subJenreID; 7 App::Import('Model', array($this->prefix.'NRWord', $this->prefix.'SWord', $this->prefix.'Check')); 8 $this->{$this->prefix.'NRWord'} = ClassRegistry::init($this->prefix.'NRWord'); constructor ClassRegistory PHP
    18. 18. ...
    19. 19. A2S ClassRegistory
    20. 20. ...SQL
    21. 21. A2S ... query SQL
    22. 22. useDbConfig useDbConfig amazon_ecommerce
    23. 23. Sample TestCase 6 class CdItemTestCase extends CakeTestCase { 7 var $CdItem = null; 8 var $fixtures = array( 23 ); 24 25 function startTest() { 26 $this->CdItem =& ClassRegistry::init('CdItem'); 27 $this->CdItem->AmazonAdvertising-> useDbConfig = 'amazon_ecommerce'; 28 }
    24. 24. App::import Behavior ... ClassRegistory::init constructor
    25. 25. m(_ _)m
    26. 26. VMware Fusion Ubuntu 9.04 ssh Mac Apache Mac/Ubuntu

    ×