# |
Aug 26th 2016, 08:12 |
slackebot |
association. But in my scenario, I only know the name of Posts->Comments association. |
# |
Aug 26th 2016, 08:12 |
fquffio |
Yeah, but in some cases the FK isn't in the target table. BelongsToMany associations have a joint table, that somehow needs to be added to the query in the JOIN clause in order to achieve the result. The `::matching()` method does exactly this: it adds conditions and joins (if needed) depending on the type of association you are dealing with. But in order to find Comments that are linked to a specific Post, you need to know the name of the Co |
# |
Aug 26th 2016, 08:08 |
voycey |
you can do conditional associations through the model layer already and you can build these on the fly if required |
# |
Aug 26th 2016, 08:08 |
voycey |
I dont really understand what you mean - the whole point of associations are that they are based off primary and foreign keys |
# |
Aug 26th 2016, 08:08 |
fquffio |
Also, conditional associations would need to be treated in a special manner, as I'd have to manually add the finder. |
# |
Aug 26th 2016, 08:07 |
fquffio |
@voycey First of all, thanks. :slightly_smiling_face: Well, your solution would work well for HasMany and HasOne associations. But I wish I could support _any_ type of association in a transparent way, thus I'd expect to interact with the `Association` object to act consistently. |
# |
Aug 26th 2016, 08:06 |
voycey |
$this->Comments->find |
# |
Aug 26th 2016, 08:06 |
voycey |
or sorry |
# |
Aug 26th 2016, 08:05 |
voycey |
? |
# |
Aug 26th 2016, 08:05 |
voycey |
why cant you just do $this->Posts->find()->where(['post_id' => $postId])->contain->(['Foo']) |
# |
Aug 26th 2016, 08:03 |
slackebot |
duplicating ORM logic. I have obtained an acceptable result calling `TableRegistry::get('Posts')->get($postId, ['contain' => ['Foo']])->get('foo')`, but this is an array of already hydrated entities, while I need to get the query object in order to paginate results. Thanks aforehand! |
# |
Aug 26th 2016, 08:03 |
slackebot |
Post. If I knew the name of the inverse association (`Bar`), that would be easily feasible using `TableRegistry::get('Comments')->find()->matching('Bar', function($q) { ... });`. Unfortunately, in this context I have no way of knowing the name of the inverse association. Is there any way of achieving the same result? I saw that `SelectableAssociationTrait::_buildQuery()` does pretty much the kind of thing I need, but it is a protected method, and I'd |
# |
Aug 26th 2016, 08:03 |
fquffio |
Hello everybody! Sorry to be obsessiveâ?¦ I asked this very same question yesterday, but I got no answer, so I'll have one last try. :) I have a table, say `Posts`, that is linked to a second table, say `Comments`, via an association named `Foo`. The inverse association (Comments -> Posts) potentially has a completely different name that doesn't follow any convention, say `Bar`. I need to obtain a Query object to find Comments that are rela |
# |
Aug 26th 2016, 07:55 |
birdy247 |
Morning :slightly_smiling_face: |
# |
Aug 26th 2016, 05:28 |
unorthodox |
Morning |
# |
Aug 26th 2016, 04:40 |
voycey |
Does anyone on here use Swagger? |
# |
Aug 26th 2016, 03:26 |
xuding |
@jeremyharris thanks |
# |
Aug 26th 2016, 03:07 |
jeremyharris |
@xuding you can invalidate the entity field like so: `$entity->errors(â??fieldnameâ??, â??error messageâ??);` (see: http://book.cakephp.org/3.0/en/orm/entities.html#validation-errors) |
# |
Aug 26th 2016, 02:58 |
xuding |
how do we manually invalidate form fields in Cake 3? |
# |
Aug 26th 2016, 02:57 |
xuding |
hi |
# |
Aug 26th 2016, 00:02 |
sinus |
eg: ``` 'redisForeverCache' => [ 'className' => 'Redis', 'duration' => '+1 year', 'host' => 'localhost', 'server' => '127.0.0.1', ], |
# |
Aug 26th 2016, 00:01 |
sinus |
```$ redis-cli 127.0.0.1:6379> exit ``` |
# |
Aug 26th 2016, 00:01 |
sinus |
I have Redis installed and also predis |
# |
Aug 26th 2016, 00:00 |
sinus |
I get `Cache engine Cake\Cache\Engine\RedisEngine is not properly configured.` |
# |
Aug 25th 2016, 23:59 |
sinus |
Hi, anyone used Redis as cache with Cake3? |
# |
Aug 25th 2016, 22:29 |
latbud |
Hey guys. I'm looking into CakePHP to add a small, custom ecommerce solution I'd build for a client's site. I'm wondering if there's any kind of PayPal integration plugin for CakePHP 3.x. I've been able to find them for 2.x but haven't had any luck with the current version. Thanks! |
# |
Aug 25th 2016, 22:26 |
nemmons |
my best guess is that it would just be inconvenient or difficult or perhaps impossible to pass that configuration option on to the Marshaller as well so that all of Marshaller's references to _joinData would be handled properly |
# |
Aug 25th 2016, 22:24 |
nemmons |
Not a big deal either way, i was just sort of curious, since so much of CakePHP *is* configurable |
# |
Aug 25th 2016, 22:23 |
nemmons |
right, @admad, thanks, i know it's not configurable, i was asking if anyone has any thoughts on why it's not configurable |
# |
Aug 25th 2016, 22:00 |
cpierce |
http://book.cakephp.org/3.0/en/controllers/request-response.html |
# |
Aug 25th 2016, 22:00 |
cpierce |
n/m found it |
# |
Aug 25th 2016, 21:50 |
cpierce |
in 2 |
# |
Aug 25th 2016, 21:50 |
cpierce |
they used to be called media views |
# |
Aug 25th 2016, 21:48 |
cpierce |
is there a sendfile for cakephp 3 |
# |
Aug 25th 2016, 21:07 |
admad |
that special key `_joinTable` is not configurable |
# |
Aug 25th 2016, 21:06 |
admad |
oh wait, you asked about `$_junctionProperty` |
# |
Aug 25th 2016, 21:04 |
admad |
* junction() |
# |
Aug 25th 2016, 21:04 |
admad |
or just `joinTable` in options |
# |
Aug 25th 2016, 21:03 |
admad |
@nemmons you can using juntion() method |
# |
Aug 25th 2016, 20:54 |
nemmons |
Good afternoon. Does anyone have any thoughts on why \Cake\ORM\Association\BelongsToMany.php->_options() doesn't allow for the user to set $_junctionProperty by passing in an option for it? Any reason that we shouldn't be able to edit $_junctionProperty? (https://github.com/cakephp/cakephp/blob/master/src/ORM/Association/BelongsToMany.php#L1359) |
# |
Aug 25th 2016, 20:43 |
saliak |
my belongsToMany Products through OrderLines ? |