ãphpã Cakephpã§ãã£ã¬ã¯ããªãæ´çããã
ä»åã¯Cakephpãã使ã£ã¦ãã£ã¬ã¯ããªæ´çã«ã¤ãã¦ã§ãã
ä»äºã§ã¯Facadeãã¿ã¼ã³ã使ãäºãå¤ã Facadeãã¿ã¼ã³ãåãå ¥ããã«ã¯ãã£ã¬ã¯ããªã®æ´çãå¿ é ã«ãªã£ã¦ãã¾ãã
Facadeãã¿ã¼ã³ã«ã¤ãã¦ã¯ä»¥ä¸ãåèã«
ä½ãããããã¨è¨ãã¨ãapp/modelsãã£ã¬ã¯ããªä»¥ä¸ã«facade,logic(service),daoã¨ããããã«æ´çãã㦠ããããã®å½¹å²ãæã£ããã¡ã¤ã«ãè¨ç½®ãããã®ã§ãã
åã¯ãªãã諦ã㦠app/modelsãã£ã¬ã¯ããªä»¥ä¸ã«å ¨ã¦ãã¡ã¤ã«ãå ¥ãã¦ããã®ã§ãã ãã¯ãè¦æ ããæªãã®ã¨ãæ¢ãã«ããã®ã§ä»åããã£ã¦ãã¨ã§èª¿ã¹ã¦ã¿ã¾ããã
è¨å®ã«ã¤ãã¦ã¯ä»¥ä¸ã®æé ã§è¡ãã¾ããã
以åãªãè¦ã¤ããããªãã£ãã®ãããããªããã©ãbootstrapã«ã¡ããã¨æ¸ãã¦ããã¾ããã å ã¿ã«cakephpã®ãã¼ã¸ã§ã³ã¯1.3ç³»
app/config/bootstrap.php
/** * The settings below can be used to set additional paths to models, views and controllers. * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) * * App::build(array( * 'plugins' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), * 'models' => array('/full/path/to/models/', '/next/full/path/to/models/'), * 'views' => array('/full/path/to/views/', '/next/full/path/to/views/'), * 'controllers' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), * 'datasources' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), * 'behaviors' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), * 'components' => array('/full/path/to/components/', '/next/full/path/to/components/'), * 'helpers' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), * 'vendors' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), * 'shells' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), * 'locales' => array('/full/path/to/locale/', '/next/full/path/to/locale/') * )); * */
pathã追å ãããããApp::buildã«æå®ãã¦ãããã°ã§ãããã£ã¦è©±ãªã®ã§
App::build(array( 'models' => array(MODELS.'facade'. DS, MODELS.'logic'. DS, MODELS.'dao'. DS) ));
ã¨ããæãã§æå®ãã¦ãããã°å¯è½ã¨ãªãã¾ãã
å ã¿ã«Cakephp1.3ã§ã¯ä¸è¨ã®ãããªã³ã¡ã³ããæ¸ãã¦ããã®ã§ãããCakephp1.2ç³»ã§ã¯ä»¥ä¸ã®ãããªè¨è¿°ã«ãªã£ã¦ãã¾ãã
/** * The settings below can be used to set additional paths to models, views and controllers. * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) * * $modelPaths = array('full path to models', 'second full path to models', 'etc...'); * $viewPaths = array('this path to views', 'second full path to views', 'etc...'); * $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...'); * */
ãã®å ´å
$modelPaths = array(MODELS.'facade'. DS, MODELS.'logic'. DS, MODELS.'dao'. DS);
ãã®ããã«æå®ããã°å¯è½ã¨ãªãã¾ãã
Cakephp1.3ç³»ã§ãä¸è¨ã®æå®ã¯å¯è½ã§ãã
注æã¨ãã¦ã¯ãã£ã¬ã¯ããªé層ãéãã®ã§ãåä¸åãã¡ã¤ã«ãåå¨ãã¦ãã¨ã©ã¼ã«ã¯ãªãã¾ããã ãã ããå ã«èªã¿è¾¼ã¾ãããã¡ã¤ã«ãã使ãã¾ããã ãªã®ã§ããã¡ã¤ã«åãåä¸ã«ãªããªãããã«prefix(æ¥é èª)ãªããsuffix(æ¥å°¾èª)ãã¤ãããªããã¦éç¨ããã¨å¹¸ãã«ãªããã¨æãã¾ãã