# |
Jul 1st 2021, 17:56 |
staccato123 |
@ndm Ah, thanks. That's not obvious from the docs. |
# |
Jul 1st 2021, 17:49 |
kevin.pfeifer |
damn that makes sense :see_no_evil: :,) i need more coffee |
# |
Jul 1st 2021, 17:42 |
ndm |
staccato123: `hasMany` associations are not being joined, they are being retrieved in a separate query. If you want them joined, then you need to join them, not contain them - check `innerJoinWith()` and `leftJoinWith()`. |
# |
Jul 1st 2021, 16:16 |
staccato123 |
(obviously the JOIN needs an ON clause as well :) ) |
# |
Jul 1st 2021, 16:16 |
staccato123 |
Fair enough, thanks for looking |
# |
Jul 1st 2021, 16:13 |
kevin.pfeifer |
can't tell you, sorry :shru |
# |
Jul 1st 2021, 16:11 |
staccato123 |
Looking at the query log, all the query needs is "JOIN resources_count ResourcesCounts" adding |
# |
Jul 1st 2021, 16:07 |
staccato123 |
error is "Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ResourcesCounts.date' in 'where clause'" as you would expect |
# |
Jul 1st 2021, 16:05 |
staccato123 |
https://pastebin.com/YHkq9NZe |
# |
Jul 1st 2021, 16:04 |
staccato123 |
*there's |
# |
Jul 1st 2021, 16:04 |
staccato123 |
There's SQL. There no JOIN |
# |
Jul 1st 2021, 16:01 |
kevin.pfeifer |
or do you get an error? |
# |
Jul 1st 2021, 16:00 |
kevin.pfeifer |
is there SQL generated when you look into it via debug kit? |
# |
Jul 1st 2021, 15:59 |
kevin.pfeifer |
:thinking_face: so you don’t need to set the extra `className` property because the alias (1st parameter) is the same as the TableObject name |
# |
Jul 1st 2021, 15:55 |
staccato123 |
yes |
# |
Jul 1st 2021, 15:55 |
kevin.pfeifer |
but the resources_counts Table Class is called `ResourcesCountsTable`? |
# |
Jul 1st 2021, 15:18 |
staccato123 |
The only unusualness is that the table for ResourcesCounts is resources_count rather than resources_counts, but I've done a setTable |
# |
Jul 1st 2021, 15:15 |
staccato123 |
https://pastebin.com/3nFKFStE |
# |
Jul 1st 2021, 15:13 |
staccato123 |
give me a sec |
# |
Jul 1st 2021, 14:47 |
kevin.pfeifer |
can you provide code examples of how you define the hasMany and how you use it? |
# |
Jul 1st 2021, 14:46 |
staccato123 |
Is there an obvious reason why my hasMany association isn't turning up when I use ->contain() ? |
# |
Jul 1st 2021, 14:45 |
info315 |
I'm not using pure SQL, I'm using th eCakePHP Migrations :) |
# |
Jul 1st 2021, 14:45 |
staccato123 |
Afternoon |
# |
Jul 1st 2021, 14:43 |
kevin.pfeifer |
uh, 5.0 is on the way :scream: |
# |
Jul 1st 2021, 14:42 |
dereuromark |
Also see https://github.com/cakephp/cakephp/wiki |
# |
Jul 1st 2021, 14:04 |
cristianhaunsen |
`CREATE TABLE a.table` |
# |
Jul 1st 2021, 14:04 |
edu.garcia |
Really appreciated Kevin |
# |
Jul 1st 2021, 14:04 |
cristianhaunsen |
you can prefix the database name in your query (if you are using pure sql) |
# |
Jul 1st 2021, 13:57 |
kevin.pfeifer |
for installation requirements see also 3.x https://book.cakephp.org/3/en/installation.html 4.x https://book.cakephp.org/4/en/installation.html |
# |
Jul 1st 2021, 13:56 |
kevin.pfeifer |
according to the composer.json cakephp 3 needs >= 5.6 and < 8.0 https://github.com/cakephp/cakephp/blob/3.x/composer.json#L31 and cakephp 4 >= 7.2 https://github.com/cakephp/cakephp/blob/master/composer.json#L25 |
# |
Jul 1st 2021, 13:53 |
info315 |
Hm no, I just want to create a few tables to a second database configuration |
# |
Jul 1st 2021, 13:52 |
edu.garcia |
Is there a table where I can see PHP x CakePHP versions compatibility |
# |
Jul 1st 2021, 13:51 |
edu.garcia |
Hi everyone |
# |
Jul 1st 2021, 13:45 |
cnizzardini |
You can call `$this->query($sql);` as well |
# |
Jul 1st 2021, 13:11 |
kevin.pfeifer |
I would guess you can achieve that via the alias function of the connection manager https://stackoverflow.com/questions/44428235/change-default-db-in-cakephp3 |
# |
Jul 1st 2021, 13:05 |
info315 |
Hi, is it possible to change the used Database Connection inside of an Migration? |
# |
Jun 30th 2021, 22:18 |
rightscoreanalysis |
ah because my method was statc :) |
# |
Jun 30th 2021, 22:18 |
rightscoreanalysis |
Using $this when not in object context |
# |
Jun 30th 2021, 22:17 |
rightscoreanalysis |
I did the same: protected $_credentials; then using $this->_crednetialsd |
# |
Jun 30th 2021, 22:17 |
rightscoreanalysis |
in the core I can see: protected $_validCiphers = ['aes']; used as: $this->$_validCiphers |
# |
Jun 30th 2021, 20:07 |
kevin.pfeifer |
basically PSR-4 says, that a namespace has to correspond with the folder-structure the class is located |