<?php class Controller_Artist extends Controller_Rest { public function get_list() { $results = Model_Artist::find( 'all', array( 'related' => array( 'tracks' ) ) ); $this->response( $results ); } }
<xml> <item> <id>1</id> <name>First Artist</name> <tracks> <track> <id>1</id> <name>First Track</name> </track> <track> <id>2</id> <name>Second Track</name> </track> </tracks> </item> <item> <id>2</id> <name>Second Artist</name> <tracks> <track> <id>1</id> <name>First Track</name> </track> </tracks> </item> </xml>
<artists> <artist> <id>1</id> <name>First Artist</name> <tracks> <track> <id>1</id> <name>First Track</name> </track> <track> <id>2</id> <name>Second Track</name> </track> </tracks> </artist> </xml>
class Format extends Fuel\Core\Format { ... }
Autoloader::add_classes(array( 'Format' => APPPATH.'classes/format.php', ));
namespace Fuel\Coreset so it always calls the Core Format class and not mine. Any ideas how to make the Controller call my class and not the core?
Phil Sturgeon wrote on Thursday 15th of September 2011:Kenzor: Try modifying the Rest controller to call \Format instead of Format. That should tell it to look in the app namespace, which will fall back to the core if nothing is there.
It looks like you're new here. If you want to get involved, click one of these buttons!