I guess you could temporarily edit the core schema and related class files to add in the relationship. I wonder if you can redefine modUser and it's relations within your custom schema - haven't tried it but sooner or later will need to do something like that!
-
☆ A M B ☆
- 2,475 Posts
Yeah... I know I can edit the core schema and regenerate its classes, but I've been reluctant to do that. MODx is kinda scary with how easily it creates database tables -- it's scary because it just as easily can blow away database tables, so I had to be really careful about redefining schemas when I had data in my database.
I found the cause of my particular problem I think... I was binding a query on modUser, but I had deleted that column from my table. I commented out a block of code, and the error disappeared. Good enough for me for now.
-
MODX Staff
- 10,725 Posts
FWIW, you can extend modUser and add relations to your custom tables. Similar approaches can be used with other classes in the framework, but we'll need to talk specifics beyond extending modUser.
-
☆ A M B ☆
- 2,475 Posts
So when you extend modUser (or any built-in MODx class) by adding extra data to a separate table that uses the MODx key, should you edit the MODx schema file and regenerate classes to make the relationship 2-way? I wouldn't think that any of the built-in MODx stuff would use any of the custom data, so in my mind, I didn't think there was a good reason to modify the MODx schema.
The other reason was simple: I wanted my info to persist in my tables even if a MODx user was deleted. Maybe that's not the right way to approach it, but it worked.
Could you have just marked the user as inactive?
-
☆ A M B ☆
- 2,475 Posts
Yeah: it was caused by an incorrect relationship. I corrected the schema/database and then updated my getCollection and getCollectionGraph methods that incorrectly tried to join on a relationship that did not exist.