ucfopen / fuelphp-crash-course

A final working copy of the FuelPHP Crash Course Tutorial
http://ucfopen.github.io/fuelphp-crash-course/
44 stars 18 forks source link

Broken Database Query #12

Closed michealparks closed 11 years ago

michealparks commented 11 years ago

The code residing in the messages controller directly under "Showing the Comments" in the tutorial doesn't work. Ian was kind enough to insert this, which does. It should replace what was previously shown in the tutorial.

public function action_view($id = null)
{
    $message = Model_Message::find($id);

    // get an array of comment models for this message
    $comments = DB::select()
            ->from('comments')
            ->where('mid', $id)
            ->as_object('Model_Comment')
            ->execute()
            ->as_array();

    // jam the objects into an array for the view
    $data = array(
        'message'  => $message,
        'comments' => $comments,
    );

    // setup view
    $this->template->title = "Message";
    $this->template->content = View::forge('messages/view', $data); 
}
michealparks commented 11 years ago

@havok2905

havok2905 commented 11 years ago

Could you let me know specifically what your error was and where it was triggered?

michealparks commented 11 years ago

The issue stemmed from an error in my code, as Kevin and I discovered today. Sorry for the false alarm!