# |
Feb 6th 2018, 16:08 |
dereuromark |
is that 2.x? |
# |
Feb 6th 2018, 16:08 |
ahmad |
I have FoodEntry.php model and food_entries table |
# |
Feb 6th 2018, 16:08 |
dereuromark |
most likely your inflection is wrong, sure you dont have a FoodEntries table and model? |
# |
Feb 6th 2018, 16:08 |
ahmad |
oo |
# |
Feb 6th 2018, 16:08 |
dereuromark |
haha you dont mean IDE detect |
# |
Feb 6th 2018, 16:07 |
hmic |
fail! |
# |
Feb 6th 2018, 16:07 |
ahmad |
File uploaded https://cakesf.slack.com/files/U94LH8DUL/F94QNDL3F/-.txt / https://slack-files.com/T053DPNCM-F94QNDL3F-f5ccddd026 - i get this error |
# |
Feb 6th 2018, 16:07 |
dereuromark |
https://github.com/dereuromark/cakephp-ide-helper/ is the solution to all your problems :slightly_smiling_face: |
# |
Feb 6th 2018, 16:06 |
ahmad |
is that how to properly load a model? |
# |
Feb 6th 2018, 16:05 |
ahmad |
File uploaded https://cakesf.slack.com/files/U94LH8DUL/F944YGBQR/-.txt / https://slack-files.com/T053DPNCM-F944YGBQR-0ecf24f87c |
# |
Feb 6th 2018, 16:05 |
ahmad |
i have this in my controller |
# |
Feb 6th 2018, 15:21 |
neon1024 |
In related news, how I can pursuade the marshaller to not marshal my json field into an array? |
# |
Feb 6th 2018, 15:21 |
neon1024 |
I’ll use json_encode($json) with the pretty print I think for the meantime |
# |
Feb 6th 2018, 15:17 |
kalle.alberg |
Try that? <pre> <? print_r(json_encode($data, JSON_PRETTY_PRINT)); ?> </pre> |
# |
Feb 6th 2018, 15:12 |
neon1024 |
I’m storing entity errors in my log as a json field, and would rather sidestep writing a recursive array output function |
# |
Feb 6th 2018, 15:11 |
neon1024 |
Is there a kind of “web friendly” var_dump ? |
# |
Feb 6th 2018, 15:11 |
zmurphy |
Ah, duh, I've had to use that when working on old cake 2 stuff with phpcs enabled. |
# |
Feb 6th 2018, 15:10 |
neon1024 |
Or `array_intersect()` if you just got all the tags from the db in one array |
# |
Feb 6th 2018, 15:10 |
neon1024 |
@h.mavisakalian I bet the Collection class could do it quicker! |
# |
Feb 6th 2018, 15:10 |
neon1024 |
As seen in the CakePHP core! :P |
# |
Feb 6th 2018, 15:10 |
neon1024 |
@zmurphy `/** @codingStandardsIgnoreStart */ Lolol /** @codingStandardsIgnoreEnd */` |
# |
Feb 6th 2018, 15:06 |
h.mavisakalian |
@zmurphy It worked, Thanks a lot. I think there is no faster way of doing this. |
# |
Feb 6th 2018, 15:06 |
zmurphy |
Does phpcs have a tag to not complain if a certain function doesn't have a doc comment? I have a few functions like viewUser() where all the doc comment would be is "Views the user" which adds nothing |
# |
Feb 6th 2018, 15:01 |
zmurphy |
At least, that's how I did it when I had to implement comma separated search terms for some of our documents |
# |
Feb 6th 2018, 14:56 |
zmurphy |
` $conditions = ['OR' => []]; foreach ($tags as $tag) { $conditions['OR'][] = ['tags LIKE' => '%'.$tag.'%']; } if (!$conditions['OR']) { return false; //Or some other identifier that there were no tags } return $table->find()->where($conditions); ` |
# |
Feb 6th 2018, 14:53 |
h.mavisakalian |
So there won’t be duplications |
# |
Feb 6th 2018, 14:52 |
h.mavisakalian |
Yea thats what I though but I need a final set of records in the end, how do I merge them ? |
# |
Feb 6th 2018, 14:52 |
dereuromark |
just iterate with for loop |
# |
Feb 6th 2018, 14:52 |
h.mavisakalian |
But thanks for the suggestion. |
# |
Feb 6th 2018, 14:51 |
h.mavisakalian |
not just those 2 |
# |
Feb 6th 2018, 14:51 |
h.mavisakalian |
This might work, but my $tag1 $tag2 is an array… I have to check every $tag |
# |
Feb 6th 2018, 14:49 |
zmurphy |
$table->find()->where(['OR' => [['tags LIKE' => '%'.$tag1.'%'], ['tags LIKE' => '%'.$tag2.'%']]]); ? |
# |
Feb 6th 2018, 14:47 |
h.mavisakalian |
Is there a way I can merge those 2 in the end ? |
# |
Feb 6th 2018, 14:46 |
h.mavisakalian |
$set1 = $table->find()->where([‘tags LIKE’ => “%”.$tag1.“%”); $set2 = $table->find()->where([‘tags LIKE’ => “%”.$tag2.“%”); |
# |
Feb 6th 2018, 14:45 |
h.mavisakalian |
but I am interested in if you can merge 2 sets of records so there are no duplications |
# |
Feb 6th 2018, 14:45 |
h.mavisakalian |
Ok, there is no way to do that using SQL ))) |
# |
Feb 6th 2018, 14:19 |
h.mavisakalian |
point )) |
# |
Feb 6th 2018, 14:19 |
h.mavisakalian |
Hardly )))))) But I get your poit )) |
# |
Feb 6th 2018, 14:19 |
admad |
*then |
# |
Feb 6th 2018, 14:19 |
admad |
they you would be out of a job |
# |
Feb 6th 2018, 14:18 |
h.mavisakalian |
Wouldn’t that be great )))))) |