# |
Jul 16th 2021, 08:29 |
paolo.bragagni |
$query = $this->Categorie ->find('search', ['search' => $this->request->getQueryParams()]) ->notMatching($return['returnmodel'], function ($q) { return $q->where([$return['returnmodel'] . '.id' => $return['returncontrollerid']]); }); |
# |
Jul 16th 2021, 08:29 |
paolo.bragagni |
how to do this? |
# |
Jul 16th 2021, 08:29 |
paolo.bragagni |
morning |
# |
Jul 15th 2021, 22:45 |
jh |
```$articles->Comments->getTable()``` |
# |
Jul 15th 2021, 22:44 |
jh |
https://api.cakephp.org/4.2/class-Cake.ORM.Table.html#getTable() |
# |
Jul 15th 2021, 22:42 |
jh |
https://book.cakephp.org/4/en/orm/table-objects.html |
# |
Jul 15th 2021, 22:42 |
jh |
https://book.cakephp.org/3/en/orm/table-objects.html |
# |
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 |