# |
May 5th 2021, 16:03 |
kevin.pfeifer |
but nah, it was really working for me |
# |
May 5th 2021, 16:03 |
kevin.pfeifer |
which "should" let you generate SQL => DBML |
# |
May 5th 2021, 16:02 |
kevin.pfeifer |
i can tell you there is a tool |
# |
May 5th 2021, 16:02 |
me1367 |
yea. Atleast the syntax looks nice and similar-ish. It's not like some completely arbitrary language that only starts to make sense when you work with it for a while. |
# |
May 5th 2021, 16:02 |
kevin.pfeifer |
their query language is called DBML https://www.dbml.org/home/ |
# |
May 5th 2021, 16:02 |
kevin.pfeifer |
as you see, thats not really SQL |
# |
May 5th 2021, 16:01 |
slackebot |
"created" datetime [default: `current_timestamp()`] "modified" datetime [default: `current_timestamp()`] } Ref: dns_records.dns_domain_id > dns_domains.id Ref: dns_records.dns_subdomain_id > dns_subdomains.id Ref: dns_records.dns_type_id > dns_types.id``` |
# |
May 5th 2021, 16:01 |
slackebot |
[not null] "created" datetime [default: `current_timestamp()`] "modified" datetime [default: `current_timestamp()`] } Table "dns_subdomains" { "id" int(10) [pk, not null] "name" varchar(255) [not null] "created" datetime [default: `current_timestamp()`] "modified" datetime [default: `current_timestamp()`] } Table "dns_types" { "id" int(10) [pk, not null] "name" varchar(255) [not null] "php_ident" int(11) [not null] |
# |
May 5th 2021, 16:01 |
kevin.pfeifer |
```Table "dns_domains" { "id" int(10) [pk, not null] "name" varchar(255) [not null] "created" datetime [default: `current_timestamp()`] "modified" datetime [default: `current_timestamp()`] } Table "dns_records" { "id" int(10) [pk, not null] "dns_domain_id" int(10) [not null] "dns_subdomain_id" int(10) [not null] "dns_type_id" int(10) [not null] "record" text [default: NULL] "bundle_ident" int(10) |
# |
May 5th 2021, 16:01 |
me1367 |
ahhh. That's a bummer but well, if it's only a few simple clicks to generate the SQL? Eh, that's acceptable. |
# |
May 5th 2021, 16:00 |
kevin.pfeifer |
but you can't put SQL in there and it looks like that |
# |
May 5th 2021, 16:00 |
kevin.pfeifer |
well yeah you can generate SQL from their own Query Language |
# |
May 5th 2021, 16:00 |
me1367 |
That's odd since it does claim so... |
# |
May 5th 2021, 15:59 |
kevin.pfeifer |
but the conversion isn't that bad |
# |
May 5th 2021, 15:59 |
kevin.pfeifer |
unfortunately its not directly compatible with SQL and needs its own language |
# |
May 5th 2021, 15:59 |
me1367 |
Thanks : > |
# |
May 5th 2021, 15:58 |
kevin.pfeifer |
https://dbdiagram.io/home |
# |
May 5th 2021, 15:58 |
kevin.pfeifer |
sure |
# |
May 5th 2021, 15:58 |
me1367 |
We have progress <3 |
# |
May 5th 2021, 15:58 |
kevin.pfeifer |
:) |
# |
May 5th 2021, 15:58 |
me1367 |
May I ask what software you're using for that? |
# |
May 5th 2021, 15:53 |
kevin.pfeifer |
did you create all your files with `bin/cake bake all tablename`? |
# |
May 5th 2021, 15:51 |
kevin.pfeifer |
well if you have more data you need to store in that junction table then the id is need anyways |
# |
May 5th 2021, 15:50 |
kevin.pfeifer |
:) |
# |
May 5th 2021, 15:49 |
devito |
feels dirty not doing it the “right way” |
# |
May 5th 2021, 15:48 |
kevin.pfeifer |
sure you can do it like that as well |
# |
May 5th 2021, 15:48 |
kevin.pfeifer |
ok |
# |
May 5th 2021, 15:47 |
devito |
sorry, so right now. I added the pk id column to the join table. Then I saved my data. the operation is successfull and the link is made. Data is populated with the correct feed_id and slug_id |
# |
May 5th 2021, 15:41 |
kevin.pfeifer |
what do you mean by that? add the id field to the table in the database? |
# |
May 5th 2021, 15:32 |
devito |
If I add the id to the table and then save, all is good in the world |
# |
May 5th 2021, 15:32 |
devito |
when I patch the entity i do see the associated entites are marshaled and created before save. |
# |
May 5th 2021, 15:31 |
devito |
and I am declaring the “field” in acessable |
# |
May 5th 2021, 15:31 |
devito |
so the associations are correct in both models |
# |
May 5th 2021, 15:29 |
devito |
actully no, thats all there…. |
# |
May 5th 2021, 15:28 |
devito |
let me try that real quick |
# |
May 5th 2021, 15:28 |
devito |
i think my issue is that im missing targetForeignKey and jointable on my associations |
# |
May 5th 2021, 15:28 |
devito |
ooo i see hmm |
# |
May 5th 2021, 15:27 |
ndm |
The primary key can be created from the two foreign key columns. |
# |
May 5th 2021, 15:26 |
ndm |
The table still needs a primary key (that doesn't mean an additional column) |
# |
May 5th 2021, 15:25 |
kevin.pfeifer |
but if you stick with the cakephp naming conventions for tables and columns it should basically put everything where it belongs |
# |
May 5th 2021, 15:21 |
kevin.pfeifer |
is the fact, that the "field" needs to set as accessible in the entity ```src/Model/Entity/Category.php protected $_accessible = [ 'name' => true, 'created' => true, 'modified' => true, 'ftp_domains' => true, ]; src/Model/Entity/FtpDomain.php protected $_accessible = [ .... 'categories' => true, .... ];``` |