class ItemController { private $mapping; public function __construct() { $this->mapping = new dmItem(); } // GET /items (liste + config) public function index($arr = null) { // ... charger les items ... return [[ 'statusCode' => 200, 'items' => $items, 'config' => $this->mapping->objectDesc(), // Métadonnées des champs ], 200]; } // GET /items/123 (détail + config) public function show($arr = null) { $id = $arr['id'] ?? 0; // ... charger l'item ... return [[ 'statusCode' => 200, 'item' => $this->mapping->map($dolibarrObject), 'config' => $this->mapping->objectDesc(), ], 200]; } }