# |
Jul 15th 2021, 22:42 |
jh |
or ->getTable() |
# |
Jul 15th 2021, 22:41 |
jh |
`$posts->comments->getTableName()` or simiar |
# |
Jul 15th 2021, 22:41 |
jh |
$tableClass->{'AssociationName')->getTableName() or similar |
# |
Jul 15th 2021, 22:39 |
jh |
oh just the table name |
# |
Jul 15th 2021, 22:38 |
jh |
get a table class instance |
# |
Jul 15th 2021, 22:38 |
jh |
setup has-many/belongs to |
# |
Jul 15th 2021, 15:31 |
sibusiso |
Resolving by doing the following: ```public function getForeignTable($column) { if ('_id' === substr($column, -3)){ $column = substr($column, 0, -3); } return Inflector::classify($column); }``` |
# |
Jul 15th 2021, 15:05 |
cnizzardini |
np, for really basic stuff I just have a shell script that i run which does all that plus runs migrations and whatever else i need. For more elaborate stuff i use github actions (or jenkins if i have to). but you don't need to worry about elaborate stuff for now. |
# |
Jul 15th 2021, 14:56 |
davidmckenzie2015 |
Yes, I agree thanks - webapp dev is a side gig - so I have some learning and refresh to do on git - thanks for the help. |
# |
Jul 15th 2021, 14:49 |
cnizzardini |
`git pull andand composer install --no-dev` and possibly some bin/cake cache clear commands added on is enough to deploy small/basic apps |
# |
Jul 15th 2021, 14:47 |
cnizzardini |
you should just learn git |
# |
Jul 15th 2021, 14:20 |
davidmckenzie2015 |
Thanks, I'll check out using rync. |
# |
Jul 15th 2021, 14:14 |
admad |
You can also use rsync to upload files to server which would be blazing fast compared to FTP |
# |
Jul 15th 2021, 13:57 |
davidmckenzie2015 |
Ya, disk space was a primary concern. Sounds like it will be better to have each webapp have its one set of cakephp files. Looks like I need to find some tutorials on how to use git hub and/or composer to manage the files on the server w/o having to transfer using an FTP client - that takes forever. Thanks for the help and tips. |
# |
Jul 15th 2021, 13:56 |
sibusiso |
Hi everyone, Quick question: given a column name like "product_id," is there a simple built-in function that will return "Products" as a foreign table? Thanks you |
# |
Jul 15th 2021, 13:43 |
cnizzardini |
There is probably some hacky way to do it with symbolic links, but I sense it being a lot of pain for little (any?) gain. What if you need to run cakephp 4.2 for one app and 4.3 for another? What about other dependency issues? Not worth. |
# |
Jul 15th 2021, 11:34 |
hmic |
the simple answer is: you dont. |
# |
Jul 15th 2021, 11:32 |
martin |
``` $this->belongsToMany('Products', [ 'foreignKey' => 'store_id', 'targetForeignKey' => 'product_id', 'through' => 'StoresProducts', 'finder' => 'active', ]);``` like this does not work so I think I also need to create that active filter in Products table, but how do I filter there on the end_date in stores_products |
# |
Jul 15th 2021, 11:27 |
martin |
I’ve a in table `Stores` a BelongsToMany relation ship with `Products`, I did add through to the relation ship, now in the through table there is an end date, so I just want to contain `Products` to the `Store` which are not expired. I already created a finder active in the `StoresProducts` table. but I think I can not use that one with the BelongsToMany? |
# |
Jul 15th 2021, 11:13 |
g.garin20191123 |
Hi everyone! I am from originally Vietnam currently live in Krasnodar, Russia. I am a full stack developer. I can work full time remotely in any time zone. I am looking for full time remote job. Please send me a message if you are looking for a good experienced developer. Thank you, Gavril. |
# |
Jul 15th 2021, 09:58 |
dereuromark |
right right |
# |
Jul 15th 2021, 09:54 |
eax |
Schema was the way forward :+1: |
# |
Jul 15th 2021, 09:54 |
eax |
@dereuromark That only returns the changed values, but thanks :) |
# |
Jul 15th 2021, 09:53 |
dereuromark |
$entity->toArray()? :) |
# |
Jul 15th 2021, 09:52 |
eax |
Sadly it does not, but good idea with the schema, trying that thanks! :) |
# |
Jul 15th 2021, 09:52 |
Martin` |
and you can also read the table schema I think |
# |
Jul 15th 2021, 09:51 |
Martin` |
it is not really a array, but it acts as one :P |
# |
Jul 15th 2021, 09:51 |
Martin` |
does `foreach ($entity as $k => $v)` not work? or array_get_keys() ? |
# |
Jul 15th 2021, 09:49 |
eax |
Hey folks :) In Cake3.8, is there a way to get the name of all the fields in an entity? |
# |
Jul 15th 2021, 06:30 |
alamnaryab |
fixed now, I was passing wrong foreign key values. |
# |
Jul 15th 2021, 06:21 |
alamnaryab |
For my above issue, I was mistakenly assigning user_ids instead of `Student_id` and `Guardian_id` so it is solved now. |
# |
Jul 15th 2021, 06:05 |
rudy1976s |
Hello good morning! I am baking some seed for my plugin: I am creating using bake: my plugin is located in vendor but the bake sometimes creates seeds in app plugin folder and sometimes in the correct path; is there a way to set path for plugin baking ? |
# |
Jul 15th 2021, 05:59 |
slackebot2 |
until I try to save `StudentGuardian` , because here I am passing `student_id` and `guardian_id` which is not yet committed to database so it is throwing error that these values does not exist in master tables. How can I handle this situation. |
# |
Jul 15th 2021, 05:59 |
alamnaryab |
Good Morning I have school project, on admission entry process, I have to enter `Students` `Guardians` also I have to add `Users` entries for both to allow them login the application. there is student2Guardian relationship table, for which model is named as `StudentGuardians` which has `student_id` and `guardian_id` fields as foreign keys. I am doing all these insertions within a Transaction (to save all or none) all is good |
# |
Jul 15th 2021, 05:37 |
admad |
Disk space is the cheapest metric unless you are gonna deploy on a floppy disk. |
# |
Jul 15th 2021, 05:36 |
admad |
Yeah 1.3 predates composer, so that's a different thing. |
# |
Jul 15th 2021, 05:22 |
slackebot2 |
with the latest version, your whole setup goes right out the window. If you're hoping to save some disc space, the effort to do so is not worth it. If you're thinking it'll save time when you do updates, composer really minimizes how long it takes, so time savings are again very probably not worth it. |
# |
Jul 15th 2021, 05:22 |
greg138 |
I used to do it that way with Cake 1.3 apps, and it worked okay, more or less, but it did cause problems. And with the rearrangement of files for autoloading and PSR compliance in Cake 3+, it's much harder to do, and causes more problems to try it. Remember that the day you need to update Cake because you need support for some new plugin in one app, but can't update it because some old plugin in a different app doesn't work |
# |
Jul 15th 2021, 05:11 |
admad |
What's your reason for wanting to use only one vendor folder? |
# |
Jul 15th 2021, 04:08 |
davidmckenzie2015 |
I just don't want to have three (for example) cakephp core folders to support three cakephp webapps. Thanks again. |
# |
Jul 15th 2021, 04:07 |
davidmckenzie2015 |
Yes, I have read cakephp.org and implemented examples there. |