# |
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 |
# |
Jun 30th 2021, 20:06 |
kevin.pfeifer |
and yes, there is the whole psr-4 autloading standard as well if you want to read into that as well (which you definitely don't need to) https://www.php-fig.org/psr/psr-4/ |
# |
Jun 30th 2021, 20:05 |
kevin.pfeifer |
here for the app src directory https://github.com/cakephp/app/blob/master/composer.json#L29 |
# |
Jun 30th 2021, 20:05 |
kevin.pfeifer |
and the same goes for the cakephp core, but just with another namepsace https://github.com/cakephp/cakephp/blob/master/composer.json#L75 |
# |
Jun 30th 2021, 20:05 |
rightscoreanalysis |
awesome thanks for the pointers |
# |
Jun 30th 2021, 20:04 |
kevin.pfeifer |
well evertyhing in your `src` directory starts with `\App` because of what is defined in the composer.json |
# |
Jun 30th 2021, 20:04 |
rightscoreanalysis |
I guess I can also refer to the Utility classes in the cake core |
# |
Jun 30th 2021, 20:04 |
kevin.pfeifer |
well its the combo of namespacing with autoloading which composer automatically does https://www.php.net/manual/en/language.oop5.autoload.php |
# |
Jun 30th 2021, 20:03 |
kevin.pfeifer |
https://www.php.net/manual/en/language.namespaces.basics.php |
# |
Jun 30th 2021, 20:03 |
rightscoreanalysis |
yeah i have been on a cake2 project for some time so I had to un-learn a lot :) |
# |
Jun 30th 2021, 20:02 |
greg138 |
That old plugin seems to be about making Twitter "look like" a database, which seems like an abstraction that's not particularly useful. |
# |
Jun 30th 2021, 20:02 |
kevin.pfeifer |
and yes, cakephp has nothing to do with that |
# |
Jun 30th 2021, 20:02 |
kevin.pfeifer |
thats the magic of PHP namespaces ;) |
# |
Jun 30th 2021, 20:02 |
greg138 |
CakePHP is just PHP... |
# |
Jun 30th 2021, 20:02 |
rightscoreanalysis |
oh nice didn't realise that was possible |
# |
Jun 30th 2021, 20:01 |
kevin.pfeifer |
either statically or create an object, however you like |
# |
Jun 30th 2021, 20:01 |
kevin.pfeifer |
well then create a generic PHP class in `src/Utility/MyTwitter.php` , give it a namespace `App\Utility` And call it anywhere you like in your app with `\App\Utility\MyTwitter` |
# |
Jun 30th 2021, 20:00 |
rightscoreanalysis |
can helpers work on the backend - in Cake I mostly see them used in the template files |
# |
Jun 30th 2021, 19:59 |
rightscoreanalysis |
I guess so yes - if it was a model $this->TwitterApi->send($foo) typ of thing |
# |
Jun 30th 2021, 19:58 |
kevin.pfeifer |
so you basically want a Helper Class which serves you as an helper between the Twitter PHP API and your app? |