Skip to content

Conversation

ghostwriter
Copy link
Contributor

@ghostwriter ghostwriter commented Dec 15, 2020

  • config/blueprint.php
  • FactoryGenerator
  • JobGenerator
  • MailGenerator
  • MigrationGenerator
  • ModelGenerator
  • NotificationGenerator
  • FormRequestGenerator
  • ResourceGenerator
  • SeederGenerator
  • TestGenerator
  • ControllerGenerator

Resolves #401

@ghostwriter ghostwriter marked this pull request as ready for review December 17, 2020 02:06
@jasonmccreary
Copy link
Collaborator

@nathane, I know it might be a bit annoying, but can you rebase or merge master. I've recently made some PHP 8 changes and want to ensure these are all still compatible.

@ghostwriter
Copy link
Contributor Author

@jasonmccreary I've rebased this branch. Ready for review.

@tanthammar
Copy link

tanthammar commented Jan 18, 2021

@nathane

Problem: Loops return types.

If you add multiple relations, you'll get duplicate return types

This

    relationships:
      belongsTo: User Team,

Generates duplicate return types on the model

//first one is ok
    public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
     {
         return $this->belongsTo(\App\Models\User::class);
     }

//second is duplicated
      public function team(): \Illuminate\Database\Eloquent\Relations\BelongsTo: \Illuminate\Database\Eloquent\Relations\BelongsTo
     {
         return $this->belongsTo(\App\Models\Team::class);
     }

@jasonmccreary
Copy link
Collaborator

@tanthammar, thanks for testing this. The relationship models need to be separated with commas. Please retry with proper syntax:

    relationships:
      belongsTo: User, Team

@tanthammar
Copy link

@jasonmccreary
I cannot have commas between the relationship models. I get an error:
Spaces works.

Example:

  Organizer: {
    name: json
    description: json nullable


    user_id: id nullable foreign onDelete:null
    team_id: id foreign
    bookon_vat_id: id nullable foreign:vats onDelete:null
    default_vat_id: id nullable foreign:vats onDelete:null


    softDeletes
    relationships:
      belongsTo: User, Team
  }

image

@ghostwriter
Copy link
Contributor Author

@tanthammar 👋🏾 hey,

Please try again without the curly braces {}. Blueprint’s syntax is not 💯 “valid” YAML, it has a few custom YAML syntax that it tries to parse and translate into valid YAML beforehand. Eg. softDeletes

@tanthammar
Copy link

I opened a ticket #416 because there is probably some issue that I need to solve before I can test this PR.

@jasonmccreary
Copy link
Collaborator

@nathane, I'm going to merge this. But may revert it if there are any issues reported unless you can solve them quickly.

@jasonmccreary jasonmccreary merged commit e966567 into laravel-shift:master Jan 25, 2021
@ghostwriter ghostwriter deleted the feature/return-type-declarations branch January 25, 2021 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return types on methods.
3 participants