Logs for #cakephp

Page 1 of 36,196, showing 100 records out of 3,619,523 total, starting on record 1, ending on 100

# At Username Text
# Today, 11:43 admad But all 3.x minor release are backwards compatible. So you can just go through the migration guides and make minor adjustments if necessary and upto to latest 3.8 release
# Today, 11:41 admad @jenil.sanghvi it has already ended.
# Today, 08:12 jenil.sanghvi Do we know the end of support for 3.2 framework?
# Today, 08:07 jenil.sanghvi Hi
# Yesterday, 20:33 grzegorek.rafal is there a way to use CakePHP 3 entities in more "explicit" way? By "explicit" I mean to define an entity with fields which are set with values from database (something like Doctrine).
# Yesterday, 20:31 grzegorek.rafal hello
# Yesterday, 12:39 ndm @adrienlambertwac That's not supported in 2.x IIRC. If that key is the primary key of the other table, then it should work out of the box I think...?
# Yesterday, 12:23 adrienlambertwac Hi everyone, anybody use again Cakephp 2.x ^^ ? I want to set my primary key in the declaration of hasOne, is it possible ? In Cakephp3.x , i use the option bindingKey, but it does not work in version 2.x :(
# Yesterday, 11:30 admad @willem see the how to core shells were switched to commands in 4.0
# Yesterday, 10:53 willem question: shells are deprecated and console command is the new shell system, right. In shells i could have multiple methods per shell e.g. calculateSingle, calculateAll and call the shell with shellname calculate_all or shellname calculate_single. In commands there seems to be only one method accepted (‘execute’). So how would i mimic/create the example with two methods in a command ?
# Yesterday, 10:43 neon1024 Is it just the fixture injector listener or are there other bits which will break? I presume the cake test suite relys on the v5/v6 api of phpunit
# Yesterday, 10:43 neon1024 Can I backport PHP Unit 7 to Cake 3?
# Yesterday, 09:18 neon1024 Morning all :wave:
# Yesterday, 08:53 conehead I will have a look!
# Yesterday, 08:51 admad selecting 'Users.id' is necessary for proper related property population, else you you will also need `->enableAutoFields()`
# Yesterday, 08:50 conehead Ah I was not. That is brilliant. Thanks
# Yesterday, 08:50 admad they would select specified fields of users and all fields of profiles
# Yesterday, 08:49 admad @conehead in case you arent aware you can pass assocations to select() `$this->Users->select(['Users.name', 'Users.id'])->select($this->Users->Profiles)`
# Yesterday, 08:48 ndm no problem :slightly_smiling_face:
# Yesterday, 08:47 conehead I am sorry
# Yesterday, 08:47 conehead Valuable lesson not to strip examples anymore :(
# Yesterday, 08:46 ndm And that's why examples shouldn't be stripped down too much ;) `hasOne` will by default use a join to include the data, so your select list excludes the fields from the join, hence it won't show up. `hasMany` will use a separare query to retrieve the data, so it will ignore your select list.
# Yesterday, 08:40 conehead @ndm Oh my god. I found it out thanks to your help. Although this is still a little bit confusing if you ask me. For `hasMany` (or any association containing more than one element) you do not need to select specific fields and the whole entity will show up in the property list. If the association is `hasOne`, then you will have to define the the fields you want to select. Example: ``` With hasMany:
# Yesterday, 08:40 slackebot $this->Articles->find()->contain(['Comments'])->select(['Articles.id, 'Articles.name, ']->first();
# Yesterday, 08:25 conehead Thank you very much for this
# Yesterday, 08:25 conehead Well I think you pushed me in the right direction. Still don't know exactly what it is....but I had to test it at a different location and there it works
# Yesterday, 08:12 ndm For a `hasOne` association the property name would be `comment`, it should be there even if no associated row would exist. Maybe you have some logic in your entity, table, or in a behavior that could skew the results...
# Yesterday, 07:59 conehead `tags` property shows up fine. `comments` property does not even exist. As soon as I change `hasOne` to `hasMany` I can see the property `comments` with a value in it
# Yesterday, 07:58 conehead Ah sorry. Guess I was just a bit unclear. Usually I do not follow the naming conventions. I change the association name, so I can load the data with singular name. Works fine all the time. I just never used `hasOne` before. ``` $article = $this->Articles->find()->contain(['Comments', 'Tags'])->first(); debug($article); ```
# Yesterday, 07:52 ndm Ah no, i was referring to the property name, that's the `propertyName` setting, ie the property on the entity where the data would be placed, `comments` vs `comment`. The association name doesn't need to be changed, also the `className` option is for the association class, not the entity class ;) How do you check whether the property exists?
# Yesterday, 07:47 conehead `$this->hasMany('Comments');` returns 1 result (or empty array if none found) `$this->hasOne('Comments');` property is not even there
# Yesterday, 07:44 conehead I changed the name to `Comment` instead of `Comments` and then set the `'classname' => 'App\Model\Comment'`. But now I just changed everything not to use any settings. Still the property is just missing on the returned object
# Yesterday, 07:41 ndm Not sure what exactly you are referring to with the entity class stuff?
# Yesterday, 07:39 conehead And I tried to change the naming so it would fit without setting the className and it does not show up at all :S
# Yesterday, 07:38 conehead Ah, thanks for the explanation for the mixins. The other problem...pretty sure that this is not the problem. I have set the entity class manually
# Yesterday, 07:35 ndm @conehead Public behavior methods are mixin methods, ie methods that can be invoked via the table object that the behavior is attached to. If multiple behaviors have the same mixin method names, then it wouldn't be possible to call a specific mixin method of a specific behavior. By default the two associations are using different property names (plural vs singular), maybe that has something to do with it.
# Yesterday, 07:17 conehead And shouldn't a hasOne relation return a result, if hasMany returns a result? I just changed `hasMany` (1 result) to `hasOne` (0 results or better, the property vanishes). Questions and more questions :)
# Yesterday, 06:18 conehead Why can't different behaviors contain methods with the same name? :S
# Yesterday, 04:55 conehead @rightscoreanalysis and it probably needs to be `_ids`
# Yesterday, 04:15 justin.denick @rightscoreanalysis ids => `[`‘2’,‘1’`]` needs to be an array.
# Jul 18th, 22:55 rightscoreanalysis my brain is melting... tired. Trying to save a hasMany relationship... is this not the correct format:delivery_types => [ 'ids' => '2,1' ]
# Jul 18th, 21:33 grzegorek.rafal hello
# Jul 18th, 18:53 joey.mukherjee Figured it out! I didn't realize Traits were a PHP thing and not a CakePHP thing. I was wondering why the docs were so sparse. Anyway, I made a new controller which included the trait and then did a return $this->profile ($id) at the end. Thanks for the help!
# Jul 18th, 18:18 yamcomnet @challgren Thanks!
# Jul 18th, 18:17 challgren @yamcomnet https://sandbox.dereuromark.de/export
# Jul 18th, 18:10 yamcomnet Need country list phone number prefixes as array. _Just use some random gist list or is there such "official" lists somewhere?
# Jul 18th, 15:03 ajibarra I am not sure what do you want to do exactly. If you can be more specific
# Jul 18th, 13:54 neon1024 8)
# Jul 18th, 13:54 spriz more elegant than what I'd end up doing @neon1024 :clap:
# Jul 18th, 13:54 spriz Sneaky sneaky
# Jul 18th, 13:54 spriz Aha
# Jul 18th, 13:48 neon1024 Not exactly elegant, but probably better than reflection as it’s still using the public api
# Jul 18th, 13:47 neon1024 Then assert on the array which was built in the callable
# Jul 18th, 13:47 slackebot <neon1024>
# Jul 18th, 13:47 neon1024 @spriz I solved it
# Jul 18th, 13:47 noel I'm a bit confused by friendsofcake/crud... the docs don't show how the RESTful urls would be structured for each type of call? Where is that information? I mean I notice that it generally conforms to the format set out here: https://book.cakephp.org/3.0/en/views/json-and-xml-views.html#enabling-data-views-in-your-application but for example with bulk delete I can't figure out what the corresponding REST url would be?
# Jul 18th, 13:34 neon1024 Maybe I’ll have to reflect the property :grimacing:
# Jul 18th, 13:28 spriz Thanks @ndm
# Jul 18th, 13:28 spriz I see I've done that elsewhere as well
# Jul 18th, 13:28 spriz Do'h! `new Stream` ofc...
# Jul 18th, 13:17 ndm @spriz You either live with converting the stream to a string (eg via `stream_get_contents()`), or you wrap the stream in a `\Psr\Http\Message\StreamInterface` object (for example `new \Zend\Diactoros\Stream($fp)`), there's not really much else you can do.
# Jul 18th, 13:15 spriz If you find something awesome, feel free to post a gist! :)
# Jul 18th, 13:12 neon1024 Thanks for the insight though @spriz I’ll have a go with some ideas
# Jul 18th, 13:12 neon1024 Yeah, that’s why I thought I’d just assert the Query instance
# Jul 18th, 13:11 spriz which is quite well done anyway :)
# Jul 18th, 13:11 spriz + I feel I end up testing the ORM itself
# Jul 18th, 13:11 spriz maybe `(` was added or something like taht
# Jul 18th, 13:11 spriz Nah, it just sucks that tests fail because some optimizations were pushed in the ORM or something like that
# Jul 18th, 13:10 neon1024 @spriz Oh no, is it that much of a pain! :grimacing:
# Jul 18th, 13:10 neon1024 I guess I could use the callback to make an array and assert that
# Jul 18th, 13:10 spriz which suck
# Jul 18th, 13:10 spriz No good answers from me, then. Besides checking raw SQL
# Jul 18th, 13:10 neon1024 Sometimes it adds contain and where, sometimes just where, etc
# Jul 18th, 13:10 spriz I found that troublesome previously
# Jul 18th, 13:10 spriz Ah yes
# Jul 18th, 13:09 neon1024 I have a behaviour which appends conditions to a query. I’d like to unit test it with various queries to ensure it’s doing what I expect
# Jul 18th, 13:09 spriz the the correct things were actually applied with ->where() ?
# Jul 18th, 13:09 spriz what do you want to test?
# Jul 18th, 13:09 spriz I'd assert on the SQL if i wanted to be that specific
# Jul 18th, 13:08 neon1024 I’m not sure how I would assert in a loop like that, I’d much prefer `$where->getConditions(): array` but it doesn’t seem to be in the API unless I’ve missed it
# Jul 18th, 13:07 neon1024 `$where = $query->clause('where'); $where->iterateParts($callable);`
# Jul 18th, 13:07 neon1024 I’d like to match a where, but I can’t get past
# Jul 18th, 13:06 neon1024 Do you get parts of the query and assert that, or assert on the SQL?
# Jul 18th, 13:06 neon1024 How do people assert on beforeFind?
# Jul 18th, 13:04 spriz I want to avoid the `stream_get_contents()` in that gist
# Jul 18th, 13:04 spriz @graziel thanks, but I think I did not explain it well enough - here is 10 lines that explain my troubles :slightly_smiling_face: https://gist.github.com/Spriz/8a3ce743f012e7ecd1714642e2256ca8
# Jul 18th, 13:00 neon1024 ..and ensure you sanitise any input query params
# Jul 18th, 12:59 neon1024 @noel If you want to sidestep the pre-flight OPTIONS request, proxy the api endpoint in your application and call that from Node
# Jul 18th, 12:58 graziel `->getBody()->write($string);
# Jul 18th, 12:58 neon1024 @noel https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
# Jul 18th, 12:58 spriz I have data in a stream I got from `fopen()` :)
# Jul 18th, 12:58 neon1024 @noel This is part of the AJAX specification to prevent cross-origin ajax requests
# Jul 18th, 12:57 spriz Hi peeps! Is there an easy way to pass on all data in a php resource/stream to `$this->response->withBody()` (It expects a PSR StreamInterface) :thinking_face:
# Jul 18th, 12:33 noel I should point out that the same request made via Postman works but it doesn't work via axios.
# Jul 18th, 12:28 noel Hi. I'm working with the friendsofcake/CRUD plugin. I'm having a problem with DELETE messages, where it's hitting pre-flight check OPTIONS and failing. Not sure whether I need to configure CakePHP or axios to fix this, nor how?
# Jul 18th, 12:22 acosonic @neon1024 suggestion to use sendgrid is good for mass mailing
# Jul 18th, 12:21 acosonic @davorminchorov as I say... A watcher to watch for that in logs, then retry once timeout occcurs, however with gmail you have limitations, like 2000 messages per day...
# Jul 18th, 11:50 davorminchorov @neon1024 nope, only timeout in the logs
# Jul 18th, 11:49 slackebot <info356>
# Jul 18th, 11:43 neon1024 I guess you can’t check the response as you don’t get one right?