DBに値を挿入するためにアクティブレコードを使用します。
他のすべてのタイプのクエリは、はるかに簡単ですが、アクティブなレコードの挿入が非常に優れているため、カスタム クエリを使用して行います。
だから私はこのコードを持っています:
$comment = array (
'point_id' => $object->id,
'title' => $object->title,
'comment' => $object->comment,
'author_name' => $object->author_name,
'is_temp' => 0,
'parent_id' => $object->parent_id
);
return $this->db->insert('comments', $comment);
ここで、サブクエリの結果として is_temp を設定できるようにしたいと考えています。これは次のとおりです。
(SELECT allow_user_comments from subjects where id='somevalue')
どうすればそれを達成できますか?
サードパーティのライブラリの使用を避けたいと思っていました。