{"id":917,"date":"2010-04-30T22:18:58","date_gmt":"2010-04-30T13:18:58","guid":{"rendered":"http:\/\/www.kazu.tv\/blog\/?p=917"},"modified":"2010-04-30T22:18:58","modified_gmt":"2010-04-30T13:18:58","slug":"symfony_3","status":"publish","type":"post","link":"https:\/\/kazu.tv\/blog\/2010\/04\/30\/symfony_3\/","title":{"rendered":"symfony\u306e\u30d5\u30a9\u30fc\u30e0\u3067\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u9078\u629e\u80a2\u3092\u7d5e\u308b"},"content":{"rendered":"<p>symfony\u306e\u8a71\u3002\u524d\u56de\u306b\u5f15\u304d\u7d9a\u304d\u3001\u5177\u4f53\u7684\u306a\u4f8b\u3092\u66f8\u304f\u3002<\/p>\n<p>\u25a0\u3084\u308a\u305f\u3044\u3053\u3068\uff1aHost\u306e\u7de8\u96c6\u753b\u9762\u3067\u3001Domain\u4e00\u89a7\u306e\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u9078\u629e\u80a2\u3092\u7d5e\u308a\u305f\u3044<\/p>\n<p>\u30c6\u30fc\u30d6\u30ebDomain\u3068Host\u304c\u3042\u3063\u3066\u3001Host.domain_id\u304cDomain.id\u3092\u53c2\u7167\u3057\u3066\u308b\u3068\u3059\u308b\u3002<\/p>\n<p>\u30c6\u30fc\u30d6\u30ebHost\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u7de8\u96c6\u753b\u9762\u3067domain_id\u306e\u7b87\u6240\u306f\u30c9\u30e1\u30a4\u30f3\u540d\u306e\u4e00\u89a7\u306e\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\uff08\u30d7\u30eb\u30c0\u30a6\u30f3\uff09\u304c\u8868\u793a\u3055\u308c\u308b\u3002\u305d\u3053\u307e\u3067\u306f\u3044\u3044\u3093\u3060\u3051\u3069\u3001\u5168\u3066\u306e\u30c9\u30e1\u30a4\u30f3\u3092\u305d\u3053\u306b\u8868\u793a\u3059\u308b\u306e\u3067\u306f\u306a\u304f\u3066\u3001\u305d\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u6240\u6709\u3057\u3066\u3044\u308b\u30c9\u30e1\u30a4\u30f3\u306e\u307f\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u3068\u3059\u308b\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u25a0\u3084\u308b\u3053\u3068<\/p>\n<p>\u25cb\u4e00\u89a7\u306b\u8868\u793a\u3055\u305b\u305f\u3044\u3082\u306e\u3060\u3051\u3092\u53d6\u5f97\u3059\u308b\u30af\u30a8\u30ea\u30fc\u3092\u4f5c\u6210<\/p>\n<p>lib\/model\/DomainTable\u3067\u3001\u300c\u6e21\u3055\u308c\u305f\u30e6\u30fc\u30b6\u30fcID\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u6240\u6709\u3059\u308b\u30c9\u30e1\u30a4\u30f3\u306e\u307f\u3092\u53d6\u5f97\u3059\u308b\u30af\u30a8\u30ea\u30fc\u300d\u3092\u8fd4\u3059\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3002<\/p>\n<pre class=\"brush: php\">\nclass DomainTable extends Doctrine_Table\n{\npublic function getQueryDomainsOfUser($user_id)\n{\n# query\u3092\u8fd4\u3059\u3053\u3068\u306b\u6ce8\u610f\nreturn $this-&gt;createQuery('a')\n-&gt;addWhere('a.user_id = ?', $user_id);\n}\n}<\/pre>\n<p>\u25cbHost\u306eactions.class.php\u306b\u3066\u3001\u30e6\u30fc\u30b6\u30fcID\u3092\u30d5\u30a9\u30fc\u30e0\u306b\u6e21\u3059\u3088\u3046\u306a\u51e6\u7406\u3092\u8ffd\u52a0\u3002<\/p>\n<pre class=\"brush: php\">\npublic function executeNew(sfWebRequest $request)\n{\n$this-&gt;form = new HostForm(null, array('user_id' =&gt; $this-&gt;getUser()-&gt;getGuardUser()-&gt;getId()));\n}\npublic function executeEdit(sfWebRequest $request)\n{\n$this-&gt;forward404Unless($host = Doctrine::getTable('Host')-&gt;find(array($request-&gt;getParameter('id'))), sprintf('Object host does not exist (%s).', $request-&gt;getParameter('id')));\n$this-&gt;form = new HostForm($host, array('user_id' =&gt; $this-&gt;getUser()-&gt;getGuardUser()-&gt;getId()));\n}\n<\/pre>\n<p>\u25cb\u30d5\u30a9\u30fc\u30e0\uff08HostForm\uff09\u5185\u3067\u3001\u5fc5\u8981\u306a\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\u3092\u53d6\u5f97\u3057\u3066\u3001\u30d7\u30eb\u30c0\u30a6\u30f3\u3092\u4f5c\u6210\u3002<\/p>\n<pre class=\"brush: php\">\nclass HostForm extends BaseHostForm\n{\npublic function configure()\n{\n# actions.list.php\u3088\u308a\u6e21\u3055\u308c\u305f$user_id\u3092\u3001\u5148\u307b\u3069\u4f5c\u3063\u305fDomainTable\u306e\u30e1\u30bd\u30c3\u30c9\u306b\u6e21\u3059\n$query = Doctrine::getTable('Domain')-&gt;getQueryDomainsOfUser($this-&gt;getOption('user_id')) ;\n# \u305d\u306e$query\u306e\u7d50\u679c\uff08\uff1d\u305d\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u6240\u6709\u3059\u308b\u30c9\u30e1\u30a4\u30f3\u4e00\u89a7\uff09\u3092\u4f7f\u3063\u3066\u3001\u30d7\u30eb\u30c0\u30a6\u30f3\u3092\u4f5c\u6210\n$this-&gt;widgetSchema['domain_id'] = new sfWidgetFormDoctrineChoice(array(\n'model' =&gt; $this-&gt;getRelatedModelName('Domain'),\n'query' =&gt; $query,\n'add_empty' =&gt; false\n));\n}\n}\n<\/pre>\n<p>\u25a0\u305d\u306e\u4ed6\u60c5\u5831<\/p>\n<ul>\n<li>\u74b0\u5883\uff1asymfony 1.4<\/li>\n<li>\u53c2\u8003\u306b\u3057\u305f\u306e\u306f\u3053\u306e<a href=\"http:\/\/groups.google.co.jp\/group\/symfony-users\/browse_thread\/thread\/e8c92d065a5204c4\" target=\"_blank\">\u30da\u30fc\u30b8<\/a>\u3002<\/li>\n<li>widget\u306b\u3064\u3044\u3066\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u7684\u306a\u8aac\u660e\u306f<a href=\"http:\/\/www.symfony-project.org\/forms\/1_2\/ja\/A-Widgets\" target=\"_blank\">\u3053\u3053<\/a>\uff08symfony 1.2\u306e\u3082\u306e\u3060\u3051\u3069\u3001\u7279\u306b\u554f\u984c\u306a\u3057\uff09\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>symfony\u306e\u8a71\u3002\u524d\u56de\u306b\u5f15\u304d\u7d9a\u304d\u3001\u5177\u4f53\u7684\u306a\u4f8b\u3092\u66f8\u304f\u3002 \u25a0\u3084\u308a\u305f\u3044\u3053\u3068\uff1aHost\u306e\u7de8\u96c6\u753b\u9762\u3067\u3001Domain\u4e00\u89a7\u306e\u30ea\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306e\u9078\u629e\u80a2\u3092\u7d5e\u308a\u305f\u3044 \u30c6\u30fc\u30d6\u30ebDomain\u3068Host\u304c\u3042\u3063\u3066\u3001Host.domain_id\u304cDo&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[401],"tags":[671,689,690,691,692,693,694],"class_list":["post-917","post","type-post","status-publish","format-standard","hentry","category-php","tag-doctrine","tag-sfwidget","tag-sfwidgetformdoctrinechoice","tag-symfony-1-4","tag-692","tag-693","tag-694"],"_links":{"self":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/comments?post=917"}],"version-history":[{"count":0,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/posts\/917\/revisions"}],"wp:attachment":[{"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/media?parent=917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/categories?post=917"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kazu.tv\/blog\/wp-json\/wp\/v2\/tags?post=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}