# |
Feb 6th 2018, 12:22 |
neon1024 |
What do you mean? The calling class or the result? |
# |
Feb 6th 2018, 12:19 |
hmic |
neon1024: what class is new Entity vs. $table->newEntity()? |
# |
Feb 6th 2018, 12:17 |
neon1024 |
Think I’ll suggest an amend to the docs when I’m done :slightly_smiling_face: |
# |
Feb 6th 2018, 12:16 |
neon1024 |
That feels like something which should be told to users here, https://book.cakephp.org/3.0/en/orm/entities.html#creating-entities |
# |
Feb 6th 2018, 12:15 |
neon1024 |
What is the difference between `$entity = new Entity(['foo' => 'bar']);` and `$entity = $this->Examples->newEntity(['foo' => 'bar']);` as in, why is using the repository different? Is it just that the Table class will run the marshaller, whereas direct instantiation will only assign values? |
# |
Feb 6th 2018, 12:13 |
neon1024 |
`find()->where(['tags LIKE' => $tags])` |
# |
Feb 6th 2018, 12:02 |
h.mavisakalian |
find(‘all’, [ ‘conditions’ => [ ‘user_id’ => $user[‘id’], ‘tags’ => ‘LIKE $string’ ] ]) |
# |
Feb 6th 2018, 12:02 |
h.mavisakalian |
something like |
# |
Feb 6th 2018, 12:01 |
h.mavisakalian |
How can I add a exists condition when fetching data from table ? example.. I need to see if the string contains data from another string… |
# |
Feb 6th 2018, 10:22 |
neon1024 |
With a find() I mean, obviously not a first() as that’s taking a single item from the collection |
# |
Feb 6th 2018, 10:22 |
neon1024 |
As a query returns a ResultSet which implement ResultSet interface, it is a sensible default to assume the collection contains entities? |
# |
Feb 6th 2018, 09:42 |
neon1024 |
Ahh a fork |
# |
Feb 6th 2018, 09:42 |
neon1024 |
https://github.com/dereuromark/CakePHP-DatabaseLog |
# |
Feb 6th 2018, 09:42 |
neon1024 |
I was going to say I bet @dereuromark has done it already, and well.. whaddya know! |
# |
Feb 6th 2018, 09:41 |
neon1024 |
Hahaha! |
# |
Feb 6th 2018, 09:39 |
slackebot |
!awesome |
# |
Feb 6th 2018, 09:39 |
slackebot |
Command sent from Slack by neon1024: |
# |
Feb 6th 2018, 09:39 |
neon1024 |
Sounds like a good opportunity to write a plugin |
# |
Feb 6th 2018, 09:32 |
hmic |
but it's only 3 methods you need to implement to make it work, should be a breeze |
# |
Feb 6th 2018, 09:32 |
hmic |
i would have bet my bottom dollar ont hat |
# |
Feb 6th 2018, 09:32 |
hmic |
actually, there seems not to be one in the core :[ |
# |
Feb 6th 2018, 09:31 |
neon1024 |
Thanks for the tip hmic, I’ll look into that :slightly_smiling_face: |
# |
Feb 6th 2018, 09:31 |
neon1024 |
http://woofraise.com/blog1/wp-content/uploads/2012/08/no-way-tell-me-more.jpg |
# |
Feb 6th 2018, 09:30 |
neon1024 |
ORLY? |
# |
Feb 6th 2018, 09:30 |
hmic |
what would your read on the other hand? - yeah a database. there is a database log adapter! |
# |
Feb 6th 2018, 09:30 |
neon1024 |
Think I’ll just add a config value and log directly to the ORM |
# |
Feb 6th 2018, 09:29 |
neon1024 |
I don’t want to use actual logging because i’ll have to read that text file in the admin |
# |
Feb 6th 2018, 09:29 |
hmic |
so you would write a log? |
# |
Feb 6th 2018, 09:29 |
hmic |
if it's just a simple method call, could even be a trait only you use in the apicontroller and shell |
# |
Feb 6th 2018, 09:29 |
neon1024 |
The idea is that the shell runs on a cron and scheduled in the admin, and I’d like to have a log in the admin with nice display of what’s happened and when |
# |
Feb 6th 2018, 09:28 |
hmic |
but if you can call that api to do stuff, why not create a businesslogic class from what it's doing and use that in the shell too? (even to listen to your custom events in both cases) |
# |
Feb 6th 2018, 09:28 |
neon1024 |
Just not sure I want to add a data store dep to the plugin |
# |
Feb 6th 2018, 09:28 |
neon1024 |
Well I want to log to the data store, so not a big deal |
# |
Feb 6th 2018, 09:27 |
neon1024 |
I can’t add dependancies |
# |
Feb 6th 2018, 09:27 |
hmic |
yeah, sure. an api call would be a kind of a messaging system ;-) |
# |
Feb 6th 2018, 09:27 |
birdy247 |
all good |
# |
Feb 6th 2018, 09:27 |
birdy247 |
ignore me |
# |
Feb 6th 2018, 09:27 |
hmic |
it's not. you need to put a queue or messaging system in place |
# |
Feb 6th 2018, 09:26 |
neon1024 |
Will have to figure out a different logging solution, perhaps an api call |
# |
Feb 6th 2018, 09:26 |
birdy247 |
2015/10/20 14:14 |
# |
Feb 6th 2018, 09:26 |
birdy247 |
Im holding a datetime as a string (long story) |