# |
Apr 26th 2021, 09:13 |
neon1024 |
Well you can alias a table class |
# |
Apr 26th 2021, 09:12 |
noel |
No.. `belongsTo` |
# |
Apr 26th 2021, 09:12 |
neon1024 |
Maybe, I thought you had `belongsToMany` |
# |
Apr 26th 2021, 09:12 |
noel |
What does that mean? |
# |
Apr 26th 2021, 09:12 |
neon1024 |
Maybe it needs a specific alias? |
# |
Apr 26th 2021, 09:12 |
noel |
It’s a manyToOne – can’t be inversed as I understand it. |
# |
Apr 26th 2021, 09:11 |
neon1024 |
Perhaps it needs to be inversed? Do you have an association in PeopleTable? |
# |
Apr 26th 2021, 09:11 |
noel |
No warnings |
# |
Apr 26th 2021, 09:11 |
neon1024 |
`Cake\ORM\Table` instance instead of concrete? |
# |
Apr 26th 2021, 09:11 |
neon1024 |
Do you get a warning about ` |
# |
Apr 26th 2021, 09:10 |
noel |
I think so… it returns a query object anyway. |
# |
Apr 26th 2021, 09:08 |
neon1024 |
Can you traverse the association? `$this->Enquiries->Notaries->find()` ? |
# |
Apr 26th 2021, 09:07 |
noel |
In concrete terms. I have `people` and `enquiries` tables. I’m trying to set up a relationship between the two via the following association on the `enquiries` table: ```$this->belongsTo('Notaries', ['className' => 'People', 'foreignKey' => 'notary_id']);``` However if I then grab the PeopleTable instance and look at the `_associations` property, `enquiries` is not listed as an associated table. |
# |
Apr 26th 2021, 09:06 |
neon1024 |
My first guess would be a typo :) |
# |
Apr 26th 2021, 09:02 |
noel |
Hi all. I’m having trouble with associations. The issue is that if I try to create a manyToOne association with a custom name and an aliased foreignKey, that association does not get listed in $table->_associations. |
# |
Apr 26th 2021, 09:02 |
neon1024 |
Yeah, okay, thanks. I’ll keep hunting in the docs and do some testing on my docker db instance :) |
# |
Apr 26th 2021, 09:01 |
noel |
@neon1024 mm… that doesn’t sound right no. I might be wrong but my understanding of lock means that it is locked by a process, so that only that process can use the table. Which means inserts that are part of that transaction can happen but any queries (INSERT or otherwise) that are not part of that transaction cannot happen. |
# |
Apr 26th 2021, 09:00 |
neon1024 |
Ah right, thanks! So if I am running a transaction, no inserts can happen right? |
# |
Apr 26th 2021, 08:58 |
noel |
Yes |
# |
Apr 26th 2021, 08:56 |
neon1024 |
Do transaction queries lock db tables? |
# |
Apr 26th 2021, 03:56 |
admad |
@turkles https://github.com/itosho/easy-query#bulk-upsert |
# |
Apr 26th 2021, 02:26 |
slackebot |
save_or_update maybe? (up to 10k entries in a go.. though..) |
# |
Apr 26th 2021, 02:26 |
turkles |
Hi all, I have an app which grabs data from an external API. They recently changed ID format from INT to CHAR and it broke my app a little.. The order of items in the API is not great, and my saving fails when an entry is duplicated. Previously I was using a query on 'id IN' => $api_ids and skipping ones I had already. This doesn't work with chars, is there a better way of dealing with this? Should I just turn on |
# |
Apr 25th 2021, 16:35 |
kevin.pfeifer |
thx admad for clearing that up :man-bowing: |
# |
Apr 25th 2021, 16:33 |
kevin.pfeifer |
ha, i missed that completely |
# |
Apr 25th 2021, 16:32 |
admad |
Casing matters |
# |
Apr 25th 2021, 16:32 |
admad |
Which not the same as 'Cake.pdf'. |
# |
Apr 25th 2021, 16:30 |
kevin.pfeifer |
to be fair, `$this->viewBuilder()->setClassName('CakePdf.Pdf');` is present in the usage section of https://github.com/FriendsOfCake/CakePdf |
# |
Apr 25th 2021, 16:29 |
admad |
Class names configs never take extensions |
# |
Apr 25th 2021, 16:28 |
admad |
mogpusse: just read the plugin docs instead of crappy tutorials like that. `setClassName('CakePdf.pdf')` is incorrect |
# |
Apr 25th 2021, 15:18 |
mogpusse |
slackebot i have use this tutorail https://codethepixel.com/cakephp/cakephp-4-print-pdf-using-cakepdf |
# |
Apr 25th 2021, 15:16 |
mogpusse |
slackebot thks for you help |
# |
Apr 25th 2021, 15:15 |
kevin.pfeifer |
sorry but i am out of ideas :man-shrugging: |
# |
Apr 25th 2021, 15:13 |
mogpusse |
slackebot i have this file |
# |
Apr 25th 2021, 15:12 |
kevin.pfeifer |
do you now have ```vendor/friendsofcake/cakepdf/src/View/PdfView.php``` |
# |
Apr 25th 2021, 15:11 |
mogpusse |
slackebot i have do this but i have the same error |
# |
Apr 25th 2021, 15:07 |
Absalom |
OK |
# |
Apr 25th 2021, 15:03 |
kevin.pfeifer |
https://book.cakephp.org/4/en/quickstart.html |
# |
Apr 25th 2021, 15:03 |
kevin.pfeifer |
i would recommend you try the quick start guide before |
# |
Apr 25th 2021, 15:03 |
kevin.pfeifer |
depends on how fast you can learn ;) But basically if your database structure is build with the cakephp naming conventions in mind then you can generate everything (controllers, models and templates) with just a few commands. See https://book.cakephp.org/4/en/intro/conventions.html and https://book.cakephp.org/2/en/console-and-shells/code-generation-with-bake.html |
# |
Apr 25th 2021, 14:59 |
Absalom |
I think it's fine (nubuilder looks like some Windows 3.1 system ;-) What about achieving such an application in some days? |