bake icon indicating copy to clipboard operation
bake copied to clipboard

Primary key excluded from $_accessible array for has many relationship tables

Open othercorey opened this issue 2 years ago • 4 comments

Description

If you have a table such as day_events which has day_id and created_at as the primary key, these columns are excluded from the generated $_accessible array in the Entity.

The created_at column will also be missing from the validator config in the Table.

Bake Version

2.7.0

PHP Version

No response

othercorey avatar Jun 15 '22 15:06 othercorey

This seems to expect the primary key to be generated. However, for multi-column keys, that's probably not true.

Users can work around it by removing the primary key and introducing the individual constraints they represent.

othercorey avatar Jun 16 '22 05:06 othercorey

@othercorey Hi, so your suggestion would be adding both columns to $_accessible for multi-column primary key?

ajibarra avatar Jul 08 '22 08:07 ajibarra

@othercorey Hi, so your suggestion would be adding both columns to $_accessible for multi-column primary key?

Yes. For a complete solution, we should decide if a primary key could be autogenerated or not.

othercorey avatar Jul 08 '22 18:07 othercorey

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

github-actions[bot] avatar Jan 11 '23 00:01 github-actions[bot]