iberflow / laravel-model-generator

Laravel 5 model generator for an existing schema
264 stars 76 forks source link

Generate PhpDoc for properties autocomplete in IDE #18

Closed barbushin closed 7 years ago

barbushin commented 8 years ago
/** @property integer $id */
/** @property string $data */
class EventData extends Model
{
    protected $table = 'events_data';
}
iberflow commented 8 years ago

Pull request for this is welcome! :)

pdiveris commented 8 years ago

Hi guys, I 've just added this functionality (tested only with mysql). What's the best way of contributing? Is it a clone / save / commit / push? Not sure how 'pull requests' work?!

iberflow commented 8 years ago

Yep, usually you fork the repo, create the fix/patch/update, commit the changes and submit a pull request. Prior to doing please make sure that the code will not break the package when using postgre or any other engine. basically you should have a check which will make sure that for other engines this feature isn't supported. Also, please make sure, that the docblocks you generate follow the following style convention:

/**
 * @var string
 */

This isn't defined by PSR but it's the usual style for writing docblocks for properties.

Thanks!

pdiveris commented 8 years ago

Yep, that's what I've done. Will fork / commit / submit pull request this evening, cheers.

Comments come out as follows:

`/**

What I haven't got a a proper mapper between postgres and php data types, so it will simply return string for all types (bit it won't break!)

pdiveris commented 8 years ago

Hi, I've forked / edited / committed / pushed and finally done a pull request - I am hoping that this is the right sequence! I have tested the types function with mysql, mssql and postgres 9.3, I think it should work. Please let me know if there are any issues as this workflow is new to me!

pdiveris commented 8 years ago

Hi, is there something you don't like with the code?

iberflow commented 8 years ago

Hey, I just haven't had the time to check it:) going to do it later this evening:)

pdiveris commented 8 years ago

OK, I take it this is not a priority. Seeing as the code doesn't handle views and is not that smart in guessing types I will simply rebrand my fork and carry on with my branch as a separate project. Thanks for the existing work.

barbushin commented 7 years ago

@ignasbernotas Sorry, but why it's closed? There was no merged PR or commits that resolves this issue.

But it's one of the most important thing about models - listing available fields. PhpDoc properties generation is really important to have to prevent stupid typo mistakes with models attributes names, and also it really helps to list all available attributes without need to check it in database.