# |
Jul 6th 2018, 09:17 |
josbeir |
DateTimeType uses Time i think |
# |
Jul 6th 2018, 09:17 |
lorenzo |
@k4t well, for the most pat collections are lazy, you will not iterate all elements until you demand them |
# |
Jul 6th 2018, 09:17 |
josbeir |
Time |
# |
Jul 6th 2018, 09:16 |
neon1024 |
DateTime, Chronos, Time or Date? |
# |
Jul 6th 2018, 09:16 |
neon1024 |
Ah, but which one?! |
# |
Jul 6th 2018, 09:16 |
josbeir |
check datetimetype |
# |
Jul 6th 2018, 09:16 |
josbeir |
cake knows what to do with it |
# |
Jul 6th 2018, 09:16 |
josbeir |
just pass a DateTime object |
# |
Jul 6th 2018, 09:16 |
k4t |
@lorenzo if order or returned object will meet my needs than yes, ->first will be enough but still... I have to iterate over whole collection. I am curious if it is possible to do not do this |
# |
Jul 6th 2018, 09:16 |
neon1024 |
So i guess `DATE_FORMAT()` |
# |
Jul 6th 2018, 09:16 |
josbeir |
then you need to convert that into a datetime string to |
# |
Jul 6th 2018, 09:16 |
neon1024 |
Nope, I used `datetime` |
# |
Jul 6th 2018, 09:15 |
neon1024 |
@josbeir Thanks, I’ll go write some code rather than second guessing myself! :thumbsup: |
# |
Jul 6th 2018, 09:15 |
josbeir |
is your reset_token_created a unix timestamp neon? |
# |
Jul 6th 2018, 09:15 |
josbeir |
as seconds are a part of the datetime type :P |
# |
Jul 6th 2018, 09:15 |
braeden |
The <=' => is a bit of an eye-sore :) |
# |
Jul 6th 2018, 09:15 |
lorenzo |
@k4t is calling $collection->first() not enough? |
# |
Jul 6th 2018, 09:15 |
josbeir |
it should... |
# |
Jul 6th 2018, 09:15 |
neon1024 |
To the database-a-majig! |
# |
Jul 6th 2018, 09:14 |
josbeir |
do it using an expression then :) |
# |
Jul 6th 2018, 09:14 |
neon1024 |
But does datetime compare with seconds? |
# |
Jul 6th 2018, 09:14 |
k4t |
yes @lorenzo, my collection contain multiple objects which meet certain condtion but I am only interested in first one and I did not want to iterate over whole collection |
# |
Jul 6th 2018, 09:14 |
neon1024 |
Man I don’t like that `d <=' => s` |
# |
Jul 6th 2018, 09:14 |
josbeir |
there you go :slightly_smiling_face: |
# |
Jul 6th 2018, 09:14 |
neon1024 |
`->where(['reset_token_created <=' => strtotime('-1 hour')])` |
# |
Jul 6th 2018, 09:14 |
josbeir |
? |
# |
Jul 6th 2018, 09:14 |
josbeir |
< DATE_SUB(NOW(),INTERVAL 1 HOUR) |
# |
Jul 6th 2018, 09:13 |
lorenzo |
@k4t is there a reason you need to do that? |
# |
Jul 6th 2018, 09:13 |
neon1024 |
Sorry for a stupid question, but my brain is rebelling. I want to see if a `datetime` mysql column is not older than 1 hour. |
# |
Jul 6th 2018, 09:13 |
k4t |
Hi I am filtering collection of object using ->filter method. How I can break the iteration under certain condition in filter function callback? |
# |
Jul 6th 2018, 09:12 |
josbeir |
most obfuscation techniques are easily unobfuscated |
# |
Jul 6th 2018, 09:12 |
josbeir |
i would also think twice in doing it, ask yourself what the purpose is and why you want to do it |
# |
Jul 6th 2018, 09:11 |
a.didier |
ok thx |
# |
Jul 6th 2018, 09:11 |
josbeir |
@a.didier probably is but nothing to do with cake itself |
# |
Jul 6th 2018, 09:10 |
a.didier |
hello, is it possible to obfuscate a cake project ? |
# |
Jul 6th 2018, 09:10 |
josbeir |
probably something like that |
# |
Jul 6th 2018, 09:09 |
josbeir |
return $this->response->withStringBody($blob)>withType('pdf') |
# |
Jul 6th 2018, 09:09 |
josbeir |
:P |
# |
Jul 6th 2018, 09:09 |
josbeir |
or what lorenzo sez |
# |
Jul 6th 2018, 09:09 |
lorenzo |
that’s pretty much what you need to do |
# |
Jul 6th 2018, 09:09 |
josbeir |
just echt the blob and respond with pdf as ctype |