I have some user attributes in different areas so I want to separate them into two tables.
One is the users table with user ID. Another table holds location coordinates of the user. It’s still one location per user. It’s optional value for the user.
Because It seems to me that users table is too important to mess around and it won’t change as much as the location table, I want to make location table a new table. Is this good practice?
But then can I associate these 2 tables as one-to-many and belongs-to still? So I can still use them as normal associated models in controllers? Only they are actually in one to one assocation.
It is usually more simple to deal only with one table, but you can still doing it if you want to.
You can use the
hasOnerelation for it.You should use it in both models.
You can read more about it here:
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasone