Log message #4223102

# At Username Text
# Jan 20th 2020, 15:45 neon1024 Question for Jose really, he wrote the ORM and would know better
# Jan 20th 2020, 15:45 neon1024 As you can see here https://github.com/cakephp/cakephp/blob/3.8.8/src/ORM/ResultSet.php#L517
# Jan 20th 2020, 15:44 neon1024 It sure does!
# Jan 20th 2020, 15:43 val @neon1024 Thanks. `hydrate()` simply toggles the hydration.
# Jan 20th 2020, 15:37 neon1024 Perhaps easier to implement a custom ResultSet class?
# Jan 20th 2020, 15:37 neon1024 https://github.com/cakephp/cakephp/blob/3.8.8/src/ORM/ResultSet.php#L579
# Jan 20th 2020, 15:36 neon1024 ..and associations
# Jan 20th 2020, 15:36 neon1024 So that contained associations returned the new special type as well
# Jan 20th 2020, 15:36 neon1024 https://github.com/cakephp/cakephp/blob/3.8.8/src/ORM/ResultSet.php#L522
# Jan 20th 2020, 15:36 neon1024 You’d also want to do it for matching
# Jan 20th 2020, 15:33 neon1024 …and doesn’t match the framework documentation and the code is often hidden and not obvious, making the behaviour hard to understand, unless you “just know it”
# Jan 20th 2020, 15:32 neon1024 Although I’m not a fan of changes like this because it’s often undocumented and produces behaviour which isn’t consistent with the framework
# Jan 20th 2020, 15:31 neon1024 That controls the conversion
# Jan 20th 2020, 15:29 neon1024 I’d look at `_hydrate()` method in Query
# Jan 20th 2020, 15:24 val @ndm, @admad what method should be overriden if I want that `Cake\ORM\Query->first()` would return a special object instead of `null` in case when no record is found in 3.x? I have difficulties in locating places where the entities are actually constructed.
# Jan 20th 2020, 14:23 ricksaccous @admad nice if that's the case that might make things loads easier, i'm going to try that
# Jan 20th 2020, 14:07 martin https://www.munderwood.ca/index.php/2017/02/28/responding-to-http-options-requests-in-cakephp/ this way
# Jan 20th 2020, 14:07 martin fixed the options method with a middleware :)
# Jan 20th 2020, 13:36 admad you can instead just use `$file->getStream()->getMetadata()['uri']` to get the file path to pass to flysystem
# Jan 20th 2020, 13:35 ndm or reattach it
# Jan 20th 2020, 13:35 admad so be sure you don't need to use the stream instance afterwards :)
# Jan 20th 2020, 13:34 admad "After the stream has been detached, the stream is in an unusable state."
# Jan 20th 2020, 13:33 ndm np
# Jan 20th 2020, 13:33 ricksaccous Thanks
# Jan 20th 2020, 13:32 ndm so `$upload->getStream()->detach()`
# Jan 20th 2020, 13:32 ricksaccous Alright awesome I'll try detach
# Jan 20th 2020, 13:32 ndm detach() will give you the resource ig neccesary
# Jan 20th 2020, 13:32 mr.kusmadi @ricksaccous Use this $datas = $this->request->getData(); $datas['logo']->getClientMediaType(); //to check type of file $datas['logo']->getClientFilename(); //to get filename
# Jan 20th 2020, 13:32 admad it's sad the flysystem doesn't directly support psr7 stream objects
# Jan 20th 2020, 13:31 ricksaccous Or whatever that library is
# Jan 20th 2020, 13:31 ricksaccous To feed it to FlySystem Adapters lol
# Jan 20th 2020, 13:31 ndm Why would you want to do that?
# Jan 20th 2020, 13:30 ricksaccous So how do I turn it into a resource after calling getStream()?
# Jan 20th 2020, 13:29 ndm And a class that calls itself stream isn't a resource, but it usually holds a resource
# Jan 20th 2020, 13:28 ndm @ricksaccous All streams are resources, but not all resources are streams. To obtain the stream of an uploaded file object, use its `getStream()` method.
# Jan 20th 2020, 13:26 HumanG33k and the wrong json
# Jan 20th 2020, 13:26 HumanG33k @chalgren ok thx the only thing missing at the end was the application.php stuff
# Jan 20th 2020, 13:25 martin Hi, I'm currently rebuild a project (with CRUD plugin) to REST backend, but I see that the OPTIONS http method always returns 404. what is a good way to fix this? the frontent does a OPTIONS method before delete/put to check the CORS
# Jan 20th 2020, 13:25 ricksaccous How do you translate that object you get into a resource
# Jan 20th 2020, 13:24 ricksaccous In CakePHP4 it seems that for file uploads you get that object but the file property is private that I'm used to using
# Jan 20th 2020, 13:23 ricksaccous I'm having trouble wrapping my head around the difference between streams and resources and consequently getting a resource from a stream