gabordemooij / redbean

ORM layer that creates models, config and database on the fly
https://www.redbeanphp.com
2.31k stars 280 forks source link

id vs Id Case SenSitViTy #252

Closed geniuswebtools closed 11 years ago

geniuswebtools commented 11 years ago

I'm trying to use redbean to setup a small app that let's me sync data between two sources. The problem I have is that I can't take advantage of beans because the 3rd party table uses Id instead of id.

Is there any way to map Id to id so that it will work properly, w/o me having to modify schemas?

gabordemooij commented 11 years ago

No, sorry. RedBeanPHP does not support that. If it's just a couple of tables you could use some views and rename the column(s) there. Then RedBeanPHP can read/write the views while the other app reads the table (or the other way around).

geniuswebtools commented 11 years ago

Yes, I'm actually using views to get the desired information from the cached tables.

Where I was running into an issue, was that I needed to update the record on the imported table so the view didn't pull it in again.

I just used the exec command and wrote a small function to simplify it.

Let's face it redbean does it's job, you can't account for bad DB schemas

Thanks for the code!

On Wed, Mar 20, 2013 at 3:09 PM, Gabor de Mooij notifications@github.comwrote:

No, sorry. RedBeanPHP does not support that. If it's just a couple of tables you could use some views and rename the column(s) there. Then RedBeanPHP can read/write the views while the other app reads the table (or the other way around).

— Reply to this email directly or view it on GitHubhttps://github.com/gabordemooij/redbean/issues/252#issuecomment-15196832 .

gabordemooij commented 11 years ago

huh? mysql supports updatable views doesnt it?

geniuswebtools commented 11 years ago

Ah... I see what your saying.

Map ID as id in the view and then let redbean update it that way. I know that redbean will update views, where as some other ORMs I've used do not, but I've worked around the issue at this point.

Thank you for your support.

On Wed, Mar 20, 2013 at 4:19 PM, Gabor de Mooij notifications@github.comwrote:

huh? mysql supports updatable views doesnt it?

— Reply to this email directly or view it on GitHubhttps://github.com/gabordemooij/redbean/issues/252#issuecomment-15200858 .