wintercms / winter

Free, open-source, self-hosted CMS platform based on the Laravel PHP Framework.
https://wintercms.com
MIT License
1.36k stars 192 forks source link

Winter\Storm\Database\Relations\BelongsToMany::shouldSelect(): Argument #1 ($columns) must be of type array, int given #1110

Closed goldmont closed 5 months ago

goldmont commented 5 months ago

Winter CMS Build

1.2

PHP Version

8.1

Database engine

MySQL/MariaDB

Plugins installed

No response

Issue description

Hi,

After upgrading to version 1.2.6, backend forms with relations don't work anymore:

Winter\Storm\Database\Relations\BelongsToMany::shouldSelect(): Argument #1 ($columns) must be of type array, int given, called in /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php on line 922

How can I solve? Thanks.

Steps to replicate

  1. Set-up a belongs-to-many relation
  2. Add relation partial to a form

Workaround

No response

mjauvin commented 5 months ago

I cannot replicate this, can you provide a way to replicate this using Winter.Test plugin ?

You can install the plugin with composer like this:

composer require winter/wn-test-plugin
goldmont commented 5 months ago

I cannot replicate this, can you provide a way to replicate this using Winter.Test plugin ?

You can install the plugin with composer like this:

composer require winter/wn-test-plugin

Hi,

Removing the recordsPerPage property from my config_relation.yaml seems solving the issue.

My config_relation.yaml:

assignees:
  label: calcom.management::lang.models.task.tab.assignees.relation_name
  manage:
    recordsPerPage: 20
    showSearch: true
    showSorting: true
    showSetup: false
    noRecordsMessage: 'backend::lang.list.no_records'
    defaultSort:
      column: last_name
      direction: asc
    list:
      columns:
        username:
          label: 'calcom.auth::lang.users.list.username'
          type: text
          searchable: true
          sortable: true
        first_name:
          label: 'calcom.auth::lang.users.list.first_name'
          type: text
          searchable: true
          sortable: true
        last_name:
          label: 'calcom.auth::lang.users.list.last_name'
          type: text
          searchable: true
          sortable: true
  view:
    toolbarButtons: add|remove
    recordsPerPage: 20
    showSearch: true
    showSorting: true
    showSetup: false
    noRecordsMessage: 'backend::lang.list.no_records'
    defaultSort:
      column: last_name
      direction: asc
    list:
      columns:
        username:
          label: 'calcom.auth::lang.users.list.username'
          type: text
          searchable: true
          sortable: true
        first_name:
          label: 'calcom.auth::lang.users.list.first_name'
          type: text
          searchable: true
          sortable: true
        last_name:
          label: 'calcom.auth::lang.users.list.last_name'
          type: text
          searchable: true
          sortable: true