Others Other Hibernate related projects (e.g. Hibernate OGM, Hibernate Shards).
Others Other Hibernate related projects (e.g. Hibernate OGM, Hibernate Shards).
(PgDay2012çºè¡¨è³æ) SQLã«ã¨ã£ã¦ããªãO/Rãããã¼ãéè¦ãã説æããè³æã§ããRead less
ãµã³ãã©ã³ã·ã¹ã³ã®ããã°ã©ãLaurie Vossæ°ãæ¸ããè¦éããªãè¨äºãè³ãã£ã¦ãã¾ããè¿å¹´ã®ãã¬ã¼ã ã¯ã¼ã¯ãã©ã¤ãã©ãªã®å®çªä¸ã®å®çªORãããã¼ãæ¢ã«ã¢ã³ããã¿ã¼ã³ãªã®ã§ã¯ã¨ããã®ãå½¼ã®ä¸»å¼µã§ãããã®è¨äºãæ¸ããã£ããã«ãªã£ãã®ã¯ãã®ãã¤ã¼ãã ããã§ãã I cannot overstate the degree to which ORM is a dangerous antipattern. â Laurie Voss (@seldo) June 9, 2011 ORM ãå±éºãªã¢ã³ããã¿ã¼ã³ã ã£ã¦ããã®ã¯ã©ãã ãè¨ã£ã¦ãè¨ãéãããã¨ã¯ãªã ãã®ãã¤ã¼ãã«å¯¾ãã¦åæ¹é¢(ActiveRecord, Doctrine, Hibernate)ããå¤ãã®ï¼æ¿ããï¼è¿ä¿¡ãå¯ãããã¦æ¸ãããã®ãåé¡ã®ã¨ã³ããªã§ããã¾ãã¯ã¢ã³ããã¿ã¼ã³ã¨ã¯ä½ãã®å®ç¾©ã¨ãã¦ä¸è¨ã®2ã¤ãæãã¦ãã¾ãã å½åã¯æç
ORMã®æ§æãå¿ ã使ãå¿ è¦ãªãã¦ãªãã®ã§ããã <?php // ãªãã§ãããã®ã§Connectionã¨ã£ã¦ãã $employeeTable = Doctrine_Core::getTable('Employee'); $con = $employeeTable->getConnection(); $sql = "SELECT * FROM employee where YEAR(employed_at) = :year"; $employees = $con->fetchAll($sql, array(':year' => 2009)); $sql = "SELECT * FROM employee ORDER BY employed_at DESC LIMIT 1"; $employee = $con->fetchRow($sql); $sql = "SELECT id FROM e
ãµã¤ãã«SQLã§UPDATEæãæ¸ãã¨ãã¯ãè¤æ°ã®ã¬ã³ã¼ãã«å¯¾ãã¦å¤æ´ãé©ç¨ããã¾ãããDoctrine_Recordã¯ã©ã¹ã使ã£ã¦å¤æ´ããããã¨ããã¨ãä¸ã¤ä¸ã¤ã¬ã³ã¼ããåå¾ãã¦ãsave()ã¡ã½ãããå¼ã¶ã¨ãããã¨ãããªããã°ãªãã¾ããã ããã¯ãªã½ã¼ã¹ã®ç¡é§é£ããªã®ã§ãè¤æ°ã®ã¬ã³ã¼ããä¸æ¬ãã¦å¤æ´ããå ´åã¯ãDoctrine_Queryã®update()ã¡ã½ããã使ãã¾ãã $q = Doctrine::getTable('SomeTable')->createQuery(); $q->update('SomeTable'); $q->set('field_name', 'new_field_value'); $q->where('field_name > ?', 'some_value'); $q->execute();
ã¹ãã¼ããã¡ã¤ã«ã®ç®çã¯PHPã³ã¼ãã®ç·¨éãããYAMLãã¡ã¤ã«ã§ã¢ãã«ã®å®ç¾©ãç´æ¥ç®¡çã§ããããã«ãããã¨ã§ãããã¹ã¦ã®ã¢ãã«ã®å®ç¾©/ã¯ã©ã¹ãçæããããã«YAMLã¹ãã¼ããã¡ã¤ã«ã¯è§£æãã使ããã¾ããããã«ãã£ã¦Doctrineã¢ãã«ã®å®ç¾©ãã¯ããã«ãã¼ã¿ãã«ãªãã®ã«ãªãã¾ãã ã¹ãã¼ããã¡ã¤ã«ã¯PHPã³ã¼ãã§æ¸ãé常ã®ãã¹ã¦ã®å 容ããµãã¼ããã¾ããæ¥ç¶ãã¤ã³ãã£ã³ã°ç¨ã®ã³ã³ãã¼ãã³ãããªã¬ã¼ã·ã§ã³ãå±æ§ããã³ãã¬ã¼ã/ããã¤ãã¢ãã¤ã³ããã¯ã¹ãªã©ãããã¾ãã Doctrineã¯çç¥è¨æ³ã§ã¹ãã¼ããæå®ããæ©è½ãæä¾ãã¾ããå¤ãã®ã¹ãã¼ããã©ã¡ã¼ã¿ã¯ããã©ã«ãã®å¤ãæã¡ãããã«ãã£ã¦æ§æãã§ããã®ã§Doctrineã¯ããã©ã«ããå©ç¨ã§ãã¾ãããã¹ã¦ã®çç¥è¨æ³ãå©ç¨ããã¹ãã¼ãã®ä¾ã¯ä¸è¨ã®éãã§ãã detect_relationsãªãã·ã§ã³ã«ãã£ã¦ã«ã©ã ã®ååãããªã¬ã¼ã·ã§ã³ã®æ¨æ¸¬ãè¡
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}