第26回PHP勉強会

7,481 views

Published on

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

No Downloads
Views
Total views
7,481
On SlideShare
0
From Embeds
0
Number of Embeds
45
Actions
Shares
0
Downloads
51
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

第26回PHP勉強会

  1. 1. Seasar.PHP ~PHP4 ~ eXtreme Hardcore PHP Development
  2. 2. • yonekawa • Seasar.PHP • PHP4 PHP5 eXtreme Hardcore PHP Development
  3. 3. eXtreme Hardcore PHP Development
  4. 4. eXtreme Hardcore PHP Development
  5. 5. • PHP4 2007 12 31 • PHP5 • PHP4 Compatible eXtreme Hardcore PHP Development
  6. 6. Seasar.PHP • Java • S2Container PHP • PHP5 eXtreme Hardcore PHP Development
  7. 7. S2Base.PHP5 S2Dao.PHP5 S2AnA.PHP5 S2Container.PHP5 eXtreme Hardcore PHP Development
  8. 8. S2Container.PHP5 eXtreme Hardcore PHP Development
  9. 9. DI × AOP eXtreme Hardcore PHP Development
  10. 10. $container = S2ContainerFactory::crate(‘app.dicon’); $server = $container->getComponent(‘server’); <component name=”server” class=”EchoServer”> <aspect> <component class=”S2Container_TraceInterceptor” /> </aspect> </component> eXtreme Hardcore PHP Development
  11. 11. eXtreme Hardcore PHP Development
  12. 12. class EchoServer { private $message; public function __construct(Message $m) { $this->message = $m; } } <component name=”impl” class=”MessageImpl” /> <component class=”EchoServer” autoBinding=”auto”> <!-- <arg>impl</arg> --> </component> eXtreme Hardcore PHP Development
  13. 13. InterType eXtreme Hardcore PHP Development
  14. 14. class Employee { private $id; private $name; private $product; // no getter & no setter... } eXtreme Hardcore PHP Development
  15. 15. <component name=”propertyInterType” class=”S2Container_PropertyInterType” /> <component name=”Employee”> <interType>propertyInterType</interType> </component> $emp = $container->getComponent(‘Employee’); $emp->setName(‘yonekawa’); echo $emp->getName(); // => yonekawa eXtreme Hardcore PHP Development
  16. 16. S2Dao.PHP5 eXtreme Hardcore PHP Development
  17. 17. 1. Entity 2. Dao 3. eXtreme Hardcore PHP Development
  18. 18. class Employee { const TABLE = ‘employee’; private $id; private $name; private $product; public function getId() { return $this->id; } public function setId($id) { $this->id = $id; } ... } eXtreme Hardcore PHP Development
  19. 19. interface EmployeeDao { const BEAN = ‘Employee’; public function insert(Employee $employee); public function update(Employee $employee); public function delete(Employee $employee); public function getAllEmployeesList(); } eXtreme Hardcore PHP Development
  20. 20. <component name=”EmployeeDao”> <aspect>dao.interceptor</aspect> </component> eXtreme Hardcore PHP Development
  21. 21. 2 Way SQL eXtreme Hardcore PHP Development
  22. 22. interface EmployeeDao { const BEAN = ‘Employee’; public function getEmployeesByIdList($id); } eXtreme Hardcore PHP Development
  23. 23. EmployeeDao_getEmployeesByIdList.sql SELECT * FROM employee WHERE id = /*id*/1 eXtreme Hardcore PHP Development
  24. 24. Return Type eXtreme Hardcore PHP Development
  25. 25. Entity Array YAML JSON eXtreme Hardcore PHP Development
  26. 26. $result = $dao->getEmployeeByIdJson(1) echo $result; [{quot;Employeequot;: {quot;idquot;:quot;1quot;, quot;IDquot;:quot;1quot;, quot;namequot;:quot;yonekawaquot;, quot;NAMEquot;:quot;yonekawaquot;, quot;productquot;:quot;S2AnA.PHP5quot;, quot;PRODUCTquot;:quot;S2AnA.PHP5quot;}}] eXtreme Hardcore PHP Development
  27. 27. /** * @return json */ public function getEmployeeById($id); eXtreme Hardcore PHP Development
  28. 28. S2AnA.PHP5 eXtreme Hardcore PHP Development
  29. 29. Component Context call() interceptor Client Exception!! Return Throw OK NG eXtreme Hardcore PHP Development
  30. 30. S2Base.PHP5 eXtreme Hardcore PHP Development
  31. 31. $ s2base project $ ls project app build.xml config lib test var vendor eXtreme Hardcore PHP Development
  32. 32. eXtreme Hardcore PHP Development
  33. 33. eXtreme Hardcore PHP Development
  34. 34. eXtreme Hardcore PHP Development
  35. 35. with Symfony with PRADO with Zend Framework eXtreme Hardcore PHP Development
  36. 36. • SQL S2Dao.PHP5 • S2Base.PHP5 • ZF Seasar.PHP eXtreme Hardcore PHP Development
  37. 37. Coming Soon... • ApplicationContext dicon DI & AOP • Class Injection interface DI & AOP eXtreme Hardcore PHP Development

×