title: Kohana instantiate a controller function in another controller
body: <p>i want to instantiate a kohana controller function that gets the contents from a shopping basket, in another controller.</p>
  
  <p>in other words, in one controller i have (in basket.php)</p>
  
  <pre><code>     public function action_index()
  {
      $basket   = $this-&gt;basket;
      $contents = $basket-&gt;contents-&gt;find_all();
  
      $this-&gt;view-&gt;basket   = $basket;
      $this-&gt;view-&gt;contents = $contents;
  }
  </code></pre>
  
  <p>and i want to call this function in other controller, sale.php because i want that the products already existent in the basket, to be marked somehow in the listing.
  i want to call this function in the controller sale.php, where the products are actually listed.</p>
  
  <p>i have in sale.php</p>
  
  <p>public function action_browse($id, $category_id = NULL)
      {  </p>
  
  <pre><code>    $sale = Model::factory('sale')-&gt;active()-&gt;find($id);
      $basket_content = $this-&gt;user-&gt;get_basket($sale);
  
  
      if ( ! $sale-&gt;loaded())
      { 
          throw new Kohana_Request_Exception('Sale not found.');
      }
  
      if (isset($category_id))
      {
          $category = $sale-&gt;categories-&gt;find($category_id);
          if ( ! $category-&gt;loaded())
          {
              throw new Kohana_Request_Exception('Category not found.');
          }
  
          $products = $sale-&gt;products-&gt;category($category_id)-&gt;find_all();
  
  
          $this-&gt;view-&gt;category = $category;
      }
      else
      {
          $products = $sale-&gt;products-&gt;find_all();
  
  
      }
  </code></pre>
  
  <p>Thanks!</p>