Log message #4185579

# At Username Text
# May 7th 2019, 06:40 egalles Hi everybody, I would like to know if anyone knows any app for cakephp a service for sms and cakephp to certify that a mobile phone exists for an specific user in database
# May 7th 2019, 06:29 ondrej.nedvidek Hi there, sorry was away already. The idea is to have system where is easier to add new attributes of shop products without needs to touch the database. Having them in same table gives me also option to do faster queries when filtering products than have standalone table for each attribute and multiple joins.
# May 7th 2019, 03:56 admad hmic!
# May 7th 2019, 03:34 hmic you need to set the value to 'force', if debug is disabled though!
# May 7th 2019, 03:33 hmic drailanjohn.gss: just check what i told you to. cake does that itself, automagically. it adds a timestamp of the file, so the browser can still cache it, if it's unchanged on the server - much smarter solution :-p
# May 7th 2019, 02:23 drailanjohn.gss thanks but It’s not working on my end, but I tried to put a random string on my js file, is it ok? ``` $this->Html->script('whiteboard/whiteboard.js?v'. $randString .' ', ['block' => TRUE]); ```
# May 7th 2019, 02:00 hmic drailanjohn.gss: check Asset.timestamp
# May 7th 2019, 01:42 drailanjohn.gss hi guys how prevent caching of javascript files in cake php?
# May 6th 2019, 20:05 phantomwatson Oh, cool. Thanks!
# May 6th 2019, 20:05 admad @phantomwatson
# May 6th 2019, 19:37 phantomwatson Using CakePHP 3.7.7
# May 6th 2019, 19:35 slackebot $this->assertRedirect('/api/docs/v1'); } ``` Anyone have any insight? It looks like a core bug, but I'm having a hard time believing that `assertRedirect()` is broken and I'm the only one who's ever noticed.
# May 6th 2019, 19:35 phantomwatson I'm getting this error: ``` TypeError : Argument 1 passed to Cake\TestSuite\Constraint\Response\HeaderSet::__construct() must be an instance of Cake\Http\Response, instance of Zend\Diactoros\Response\RedirectResponse given, called in C:\app\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestTrait.php on line 843 ``` when I run this integration test: ``` public function testDocsRedirect() { $this->get('/api/docs');
# May 6th 2019, 19:04 junker37 @ricksaccous thx, I'll read through that
# May 6th 2019, 19:03 ricksaccous @junker37 https://book.cakephp.org/3.0/en/orm/query-builder.html#advanced-conditions
# May 6th 2019, 19:03 ricksaccous @junker37 it's possible, maybe try organizing your or conditions in expressions, you also do not have to have two if statements there
# May 6th 2019, 18:57 slackebot $query->matching('Notes', function ($q) use ($search) { return $q->where(['Notes.data LIKE' => "%{$search}%"]); }); } ``` However, as you can guess, this will only return results if one of the `Leads` fields matches the `search` criteria *AND* the `Notes.data` field matches as well. I would like this to be *OR*, however, I can't seem to find any documentation on if this is possible.
# May 6th 2019, 18:57 junker37 Hi, I'm trying to implement a query like so: ``` if ($search) { $where['OR'] = [ 'Leads.first_name LIKE' => "%${search}%", 'Leads.last_name LIKE' => "%${search}%", 'Leads.phone LIKE' => "%${search}%", 'Leads.email LIKE' => "%${search}%", 'Leads.source LIKE' => "%${search}%" ]; } $query = $this->find('all') ->contain(['Notes']) ->where($where); if ($search) {
# May 6th 2019, 18:08 phantomwatson If that's the end of your request and you don't have any particular reason to remove that association later, it might be the simplest solution.
# May 6th 2019, 18:07 phantomwatson You could try `$tableName->addAssociations(...)`. https://book.cakephp.org/3.0/en/orm/associations.html
# May 6th 2019, 18:07 ricksaccous but seems a bit dirty
# May 6th 2019, 18:07 ricksaccous you could rename the alias in one of the models ie RequestingStaff belongsTo RequestingStaffUsers or something
# May 6th 2019, 18:06 itmpls hm, maybe i could contain the parent and rename it
# May 6th 2019, 18:06 itmpls i'm trying to somehow avoid that through whatever means possible so it doesn't conflict
# May 6th 2019, 18:05 itmpls ^
# May 6th 2019, 18:05 phantomwatson I'm trying to set up an API and a main site on the same codebase, with an `api.*` subdomain and `v1`, `v2`, etc. prefixes for API versions. Guess I'll just write `->setHost()` a million times for the sake of preventing folks from trying to access the API without the subdomain.
# May 6th 2019, 18:04 ricksaccous or leftJoinWith('SomeOtherAssociation');
# May 6th 2019, 18:04 itmpls i'm trying to avoid a naming conflict. ->contain(['RequestingStaff.Users', 'OtherTable.Users
# May 6th 2019, 18:04 ricksaccous @itmpls you can automatically join on predefined ones with methods like innerJoinWith('PredefinedAssociation');
# May 6th 2019, 18:03 ricksaccous @phantomwatson it seems like you can't do that... it seems only prefixes are a thing, i guess cakephp wasn't set up for multi-site i wonder if you could cook up a middleware to help out or something
# May 6th 2019, 18:03 phantomwatson I don't really understand what you're going for. As a strategy for updating an associated table when you save?
# May 6th 2019, 18:01 itmpls to be used by the ORM, not manual like a ->join()
# May 6th 2019, 18:01 itmpls like a dynamic one, not one within the model?
# May 6th 2019, 18:01 itmpls $query = $table->find()->setAssociation() or something?
# May 6th 2019, 18:00 phantomwatson @itmpls, do you mean this? https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-join-table
# May 6th 2019, 17:59 phantomwatson Yeah, that's what I'm trying to figure out how to do.
# May 6th 2019, 17:59 itmpls within the query itself
# May 6th 2019, 17:59 itmpls where's the docs on setting a manual association?
# May 6th 2019, 17:59 ricksaccous @phantomwatson is that not something you can scope?
# May 6th 2019, 17:47 phantomwatson @ondrej.nedvidek, what are you specifically trying to achieve?
# May 6th 2019, 17:45 phantomwatson Is there any more efficient way to set a _bunch_ of route rules to only apply to a specific subdomain than just adding `->setHost('foo.example.com')` to every rule? I thought there was something like `Router::prefix()` that you could wrap around rules to apply a `_host` constraint to each contained route, but I'm not finding that.