php - Why laravel 4.1 is giving class does not exist error for a namespaced class? -


I'm having a problem with Laravel 4.1. I am following a tutorial series in my "app" directory "Acme / Transformers" folder, which has two classes "Transformer.fp" and "Les Transstrofer.fp". When I use "LessonTransformer.php", I'm having the following problem in the LessonController class of the controller directory.

  ReflectionException category Acme \ Transformers \ LessonTransformer does not exist  " autoload ": {" classmap ": [" App / Order "," app / controller " "app /" AP / database / BG "," app / Test / Test Sisiapeepi "," app / Acme "]," SSR 0 ": {" Acme ":" app / database / migration "Acme"} < / Code>  

and

  "composer dump-autoload-o" went   

but there was no change in output I have no idea what's going on, please help me.

Here's my lesson clip Olr.afpi class

  Acme Transformers \ Les Tronsstromr; Class LessonsController \ BaseController extended the {/ ** * @ Aqua / Transformers \ LessonTransformer * / protected $ lessonTransformer; function __ conversion (text Tronsstrormr $ text Tronsstromr) {$ this- & gt; text Transformers = $ text Transformers;} / ** * display a list of resources. * * @ return response * / public function index () {$ lessons = lessons :: all (); Return Feedback: JSON (['Lesson' => $ this-> Text Transformer-> Conversion Conversion ($ lessons- & gt; ToEra ()), 200); } / ** * Display the specified resource. * * @ Ultimate $ ID * @ Response Response * / Public Function Show ($ ID) {$ lesson = lesson :: find ($ id); If (! $ Text) {Return Reaction: JSN (['Error' => ['Message' => 'Lessons do not come']], 404); } Return Feedback: JSN (['Lesson' => $ this-> Text Transformer-> Transform ($ text)], 200); } / ** * Place the map on the text archive and put it in an array, so that we can map it. * * A collection of lessons * * @ Ultimate Array $ Lesson * Returns array * / Public Function Transformation Session (array $ lesson) {Return Sir_map ([$ this, 'transform'], $ lesson); } / ** * Changing an object * Instead of returning everything, we return some selected data. * We put the keys which could expose the DB structure with some other keys because if we want to change the data keys in the future, we can change it without affecting the DB structure. * * @ Ultimate Array $ Lesson * @ Return Array * / Public Function Transform ($ text) {return ['title' = & gt; $ Text ['title'], 'body' = & gt; $ Text ['body'], 'active' => (Boolean) $ text ['some_bool']]; }}    

have you added

  namespace Acme \ Transformers;   

Text transistor.fp line at the top of the file? Also check the plurality of file names, often mistakes come from the LessonTransformer.php and LessonsFormatter named file (mind s ).

Edit

These should be the top line of your files:

App / src / Acme / Transformers / Transformer.php

  & lt ;? Php namespace Acme \ Transformers; Class Transformer {  

App / src / Acme / Transformers / Lessons Transistor.fp

  & lt; Php namespace Acme transformers; Class Text Transformer Transformer Expands {{code>  

App / Controller / SubController.FP

  & lt; Php use acme / transformers \ lace transistor; Class LessonsController Expands BaseController {   

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -