badaso icon indicating copy to clipboard operation
badaso copied to clipboard

Search returns also fields from linked table (Crud with Model)

Open Dri372 opened this issue 1 year ago • 3 comments

Badaso 2.9.4

Describe the bug Example :

  • 1 table cars linked to a table colors
  • only 1 record in each table : NoPub linked to red
  • Search for red in the cars Crud returns the record.

How to reproduce

  • create the tables : -- test_1044_1 (id:bigint;car:text, colord_id:bigint) -- test_1044_2 (id:bigint;color:text)
  • create the relationship : cars.color_id -> colors.id
  • create the Laravel Eloquent Models class Test1044_1 extends Model { public $table = 'test_1044_1'; public function color() // not color_id reserved for assessor { return $this->belongsTo(Test1044_2::class, 'id'); } } class Test1044_2 extends Model { public $table = 'test_1044_2'; }
  • create the 2 Badaso Crud using the models
  • Populate the table -- a record in Color crud : color=red (id=1) -- a record in Car crud : car=NoPub, color_id=1 (id=1)
  • Searches in the Car crud -- blank -> record NoPub -- xx -> no record -- NoPub -> record NoPub -- red -> record NoPub <------------

Dri372 avatar Oct 25 '23 06:10 Dri372

Our internal team has rechecked the error you experienced, and they have also followed the steps you mentioned. However, our team did not encounter any issues.

miftahurrahmi avatar Nov 20 '23 02:11 miftahurrahmi

Have you made sure that when performing CRUD management on the 'cars' table in the 'color_id' column, the input type is set to 'relation'? If not, and you might have chosen 'select' as the input type, the above error might occur. Also, why did you add the 'relation belongsTo' method to the custom car model when Badaso already automatically generates all types of table relations? It's better to customize only the model functions that are not available in Badaso.

Thank you for your enthusiasm in using Badaso.

miftahurrahmi avatar Dec 15 '23 02:12 miftahurrahmi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 13 '24 04:02 stale[bot]