Permalink
Browse files

Merge pull request #14 from martini2002jp/ticket-2346

#2346の修正
  • Loading branch information...
2 parents d9b1b21 + 86989de commit 12691754d73e78c565d264ba03669c810f8e8fae @balibali committed Sep 15, 2011
@@ -3,7 +3,7 @@
<?php if ($diary->member_id === $sf_user->getMemberId() || $comment->member_id === $sf_user->getMemberId()): ?>
[<?php echo link_to(__('Delete'), 'diary_comment_delete_confirm', $comment) ?>]
<?php endif; ?><br>
-<?php echo link_to($comment->Member->name, '@obj_member_profile?id='.$comment->member_id) ?><br>
+<?php echo op_link_to_member($comment->Member); ?><br>
<?php echo op_auto_link_text_for_mobile(nl2br($comment->body)) ?><br>
<?php if ($comment->has_images): ?>
<?php foreach ($comment->getDiaryCommentImagesJoinFile() as $image): ?>
@@ -36,7 +36,7 @@
<dd>
<div class="title">
<p class="heading"><strong><?php echo $comment->number ?></strong>:
-<?php if ($_member = $comment->Member): ?> <?php echo link_to($_member->name, '@obj_member_profile?id='.$_member->id) ?><?php endif; ?>
+<?php echo op_link_to_member($comment->Member); ?>
<?php if ($diary->member_id === $sf_user->getMemberId() || $comment->member_id === $sf_user->getMemberId()): ?>
<?php echo link_to(__('Delete'), 'diary_comment_delete_confirm', $comment) ?>
<?php endif; ?>
@@ -48,7 +48,7 @@ DiaryComment:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
diary_id: { type: integer(4), notnull: true }
- member_id: { type: integer(4), notnull: true }
+ member_id: { type: integer(4), notnull: false }
number: { type: integer(4), notnull: true }
body: { type: string, notnull: true }
has_images: { type: boolean, notnull: true, default: false }
@@ -58,7 +58,7 @@ DiaryComment:
onDelete: cascade
Member:
foreignAlias: DiaryComments
- onDelete: cascade
+ onDelete: set null
indexes:
diary_id_number:
fields: [diary_id, number]
@@ -1,4 +1,4 @@
SnsConfig:
op_diary_plugin_current_revision:
name: "opDiaryPlugin_revision"
- value: 8
+ value: 9
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * This file is part of the OpenPNE package.
+ * (c) OpenPNE Project (http://www.openpne.jp/)
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file and the NOTICE file that were distributed with this source code.
+ */
+
+/**
+ * opDiaryPluginMigrationVersion9
+ *
+ * change the foreign key reference to `member` on `diary_comment` from onDelete CASCADE to SET NULL
+ *
+ * @package opDiaryPlugin
+ * @author Maki TAKAHASHI <takahashi@tejimaya.com>
+ */
+class opDiaryPluginMigrationVersion9 extends opMigration
+{
+ public function up()
+ {
+ $option = array(
+ 'notnull' => false,
+ );
+ $this->changeColumn('diary_comment', 'member_id', 'integer', '4', $option);
+
+ $this->dropForeignKey('diary_comment', 'diary_comment_member_id_member_id');
+
+ $definition = array(
+ 'local' => 'member_id',
+ 'foreign' => 'id',
+ 'foreignTable' => 'member',
+ 'onDelete' => 'SET NULL',
+ );
+ $this->createForeignKey('diary_comment', 'diary_comment_member_id_member_id', $definition);
+ }
+
+ public function down()
+ {
+ $option = array(
+ 'notnull' => true,
+ );
+ $this->changeColumn('diary_comment', 'member_id', 'integer', '4', $option);
+
+ $this->dropForeignKey('diary_comment', 'diary_comment_member_id_member_id');
+
+ $definition = array(
+ 'local' => 'member_id',
+ 'foreign' => 'id',
+ 'foreignTable' => 'member',
+ 'onDelete' => 'CASCADE',
+ );
+ $this->createForeignKey('diary_comment', 'diary_comment_member_id_member_id', $definition);
+ }
+}

0 comments on commit 1269175

Please sign in to comment.