Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method to use cakephp 2 style singular model names in Aros table? #123

Open
nimisis opened this issue Aug 2, 2017 · 2 comments
Open

Method to use cakephp 2 style singular model names in Aros table? #123

nimisis opened this issue Aug 2, 2017 · 2 comments

Comments

@nimisis
Copy link

nimisis commented Aug 2, 2017

I am porting from CakePHP 2 to 3 and have noticed that the names in the 'model' field of the Aros table should now be plural (i.e. 'Group' is now 'Groups' and 'User' is now 'Users'). Is there a way to force the plugin to look for the singular form of the model name so that the database is not changed? Thanks.

@dakota
Copy link
Member

dakota commented Aug 2, 2017

The name is based on the model/table class name. CakePHP 3 has changed the convention so that tables are the plural form now.

@ghcodebase
Copy link

It is recommended to migrate from CakePHP 2.x to 3.x using a staged process (CakeFest 2017, '3.4 and the Path to 4.0.0 - Mark Story @mark_story', https://www.youtube.com/watch?v=DtH__Iz9Mjs, answer to question after 44m:15s into the video to 46m:30s). If sharing the same underlying database between a 2.x application which uses ACL and a partially upgraded 3.x version which using this plugin, how might one go about adapting the plugin, perhaps using Inflector::pluralize($aros.model), so that the plugin works on the 2.x aros table?

Would a good place to start be by altering how the model field in the ArosTable.php file is read? How might one do that to change it into plural form?

Are there likely to be any other places which need changing if it is changed via the ArosTable.php file? A search on 'model' (case insensitive) in the source code shows that most of the fixtures and test cases use the singular values User and Group, and so don't appear to have been updated for CakePHP 3.x yet. BaseAuthorize.php sets 'userModel' => 'Users', so is not using a value from the table.

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

No branches or pull requests

3 participants