Cyvelnet / laravel5-fractal

A simple fractal service provider and transformer generator for laravel >=5
MIT License
79 stars 21 forks source link

Transformer Creation Failed using namespace #24

Closed stefensuhat closed 8 years ago

stefensuhat commented 8 years ago

Hi,

I trying to run artisan make:transformer Admin/UserTransformer but keep getting error Transformer Creation Failed.

My previous project (Laravel 5.2) worked properly when creating using namespace using 1.3.1 version. Updating to 1.3.2 broke it too.

1

Any changes on 1.3.2 other than support for laravel 5.3?

Thanks.

Cyvelnet commented 8 years ago

@ssuhat yes, there is nothing change other than update composer.json

i see that, ur using forwardslash (/) which is used for directory where namespace is backslash()

btw what do you expect from artisan make:transformer Admin/UserTransformer is it the UserTransformer class going to be created under directory /xxx/Admin/ and with a namespace xxx\Admin\UserTransformer ?

im asking, cuz i hv been requested to add this feature

stefensuhat commented 8 years ago

I usually use / like when make a controller artisan make:controller Admin/UserController.

Yes you are correct. It will make file at app > Transformer > Admin > xxxxTransformer.php.

Cyvelnet commented 8 years ago

@ssuhat i hv already added the branch 2.0 with the feature above added, and now transformer generation can read your model and create those database columns for you

stefensuhat commented 8 years ago

Hi,

I'm testing it and I receive this error when create new Transformer.

untitled

I already check that my model namespace is at App and yes there is User model.

But using this command:

artisan make:transformer UserTransformer -m User works well and it's very good idea 💃 .

It works great.

Thanks

Update: Exclude and Include need to use 's' (`Fractal::excludes()) despite I already set it on my .env:

FRACTAL_EXCLUDE_KEY:exclude

Other than that it works very well.

Thanks for updating it!

Cyvelnet commented 8 years ago

@ssuhat the error has been fixed.

stefensuhat commented 8 years ago

@Cyvelnet the art make:transformer UserTransformer works perfectly.

How about the include and exclude key? I don't really mind about it though.

💃 Thanks.

Cyvelnet commented 8 years ago

@ssuhat i prefer to keep it at the moment, it might be hard for ppl from lower version, as inclusion suddently dont works and there is a missing s

stefensuhat commented 8 years ago

@Cyvelnet Ok. Than everything works perfect!. You rock!. 👯

Cyvelnet commented 8 years ago

@ssuhat i have tagged version 2.0, feel free to update to it. thx