DataMapper ORM v1.8.1 |
[eluser]Bard[/eluser]
Hi, i have a problem using foreign keys 'Content' table has many 'parts' table Parts table Code: CREATE TABLE IF NOT EXISTS `parts` ( Code: class Content extends DataMapper { Code: class Part extends DataMapper { Code: $c = new Content(); doesn't works, is it normal not to delete foreign table relation or missing something?
[eluser]WanWizard[/eluser]
Your table is missing the 'id' column, which is required in Datamapper. All operations happen on the id.
[eluser]ELRafael[/eluser]
Hi! I have a issue when I'm dealing with many to many relationships. Code: $obj = new Associado(1); This code (both blocks) is supposed to create a record in the table Pasta (mean Folder) and associate a "Associado" (can be User) to that created reg from Pasta table. The first block is doing right, INSERT INTO relationship table (associados_pastas). The second is wrong. It's trying to UPDATE (?!?!?) the relationship table (aviacao_pastas). The name of the model (Aviacaom) is right. I just configured the model using $has_many variable inside the model Code: class Pasta extends DataMapper { Anyway, thanks for any help and sorry about Portuguese language in the code. I just copy 'n paste the code.
[eluser]ELRafael[/eluser]
Gosh, I was so stupid! Sorry about the post, now I know what I did wrong. With my database schema, I need to put $has_many on the Aviacaom model, not $has_one. That's why DataMapper was trying to UPDATE, since when I put $has_one, it's 1:N relationship, not N:N Code: $has_many = array(); I hope with anyone gets this kind of error, this post can help. Peace!
[eluser]rzb13[/eluser]
I'm very sorry for double posting. I noticed too late it was not the version I'm using.
[eluser]Unknown[/eluser]
Kyle Noland Here is an ORM that works with SQL Server https://www.kellermansoftware.com/p-47-n...layer.aspx |
Welcome Guest, Not a member yet? Register Sign In |