# |
Jun 29th 2021, 22:16 |
joey.mukherjee |
How do I do an OR on a query that has a where or a matching. Something like : ->or (where (['TEST_TYPE' => 'WATR']), matching ('GroundWaterTests')) I want either TEST_TYPE is WATR or there is a related row in another table? |
# |
Jun 29th 2021, 22:13 |
khalil |
Hello! congrats on the 4000+ members :) |
# |
Jun 29th 2021, 22:13 |
kevin.pfeifer |
btw: we hit 4000+ members in the slack support channel :partying_face: |
# |
Jun 29th 2021, 22:11 |
slackebot |
testSend(): void { $this->OrderNotification->send(); }``` |
# |
Jun 29th 2021, 22:11 |
slackebot |
json_decode($this->order, TRUE); $products = $order['line_items']; $line_items = $Woocommerce->getLineItems($products); $commission = $Woocommerce->getCommission($line_items); $this->OrderNotification = new OrderNotificationMailer([ 'state_owner_email' => $state_owner->state_owner_email, 'content' => compact('state_owner', 'commission', 'operator', 'order', 'line_items') ]); } public function |
# |
Jun 29th 2021, 22:11 |
tyler.adam.lazenby |
```public function setUp(): void { parent::setUp(); $state_owner = TableRegistry::getTableLocator()->get('StateOwners')->get(1); $operator = TableRegistry::getTableLocator()->get('Operators')->find()->first(); $this->order = file_get_contents(join(DS, [ROOT, 'tests', 'Resource', 'order.json'])); $registry = new ComponentRegistry(); $Woocommerce = new WoocommerceComponent($registry); $order = |
# |
Jun 29th 2021, 22:11 |
tyler.adam.lazenby |
on the test |
# |
Jun 29th 2021, 22:11 |
tyler.adam.lazenby |
kinda funny how much setup I had to do to make sure the email went through |
# |
Jun 29th 2021, 22:11 |
kevin.pfeifer |
instead of the default Cake\Mailer\Renderer you can set a custom view instance |
# |
Jun 29th 2021, 22:10 |
tyler.adam.lazenby |
almost through this |
# |
Jun 29th 2021, 21:28 |
tyler.adam.lazenby |
what does the viewRender property of the mailer do? |
# |
Jun 29th 2021, 20:21 |
kevin.pfeifer |
but if you manually create the mailer object anyways you should be fine |
# |
Jun 29th 2021, 20:21 |
kevin.pfeifer |
But I currently don’t know if you can send reusable emails (like https://book.cakephp.org/4/en/core-libraries/email.html#creating-reusable-emails) via the queue mail task. I have already created an issue for that. |
# |
Jun 29th 2021, 20:16 |
tyler.adam.lazenby |
Working on getting my data first and then going to see if I need to update to alpha... because I need to make sure I have some complex calculations done... by the end of the dasy |
# |
Jun 29th 2021, 20:16 |
tyler.adam.lazenby |
@kevin.pfeifer I know I know... especially with abstraction |
# |
Jun 29th 2021, 20:08 |
dereuromark |
Try the New alpha, I soon release then stable |
# |
Jun 29th 2021, 19:58 |
kevin.pfeifer |
sometimes documentation is not that bad :) |
# |
Jun 29th 2021, 19:57 |
tyler.adam.lazenby |
I was poking around in the source code and wasn't seeing that |
# |
Jun 29th 2021, 19:57 |
tyler.adam.lazenby |
COOL |
# |
Jun 29th 2021, 19:57 |
tyler.adam.lazenby |
oh ok |
# |
Jun 29th 2021, 19:50 |
kevin.pfeifer |
https://github.com/dereuromark/cakephp-queue/tree/master/docs#using-built-in-email-task Here you can see that you can pass on a mailer object when creating the task => therefore yes, HTML mails are possible |
# |
Jun 29th 2021, 19:42 |
tyler.adam.lazenby |
Hey @dereuromark Does your queue plugin default email task support sending HTML emails? |
# |
Jun 29th 2021, 19:18 |
slackebot |
https://stackoverflow.com/questions/68184422/restrict-query-results-on-beforefind-table-call-back-without-breaking-buildrul |
# |
Jun 29th 2021, 19:18 |
jadelbe418 |
I am running into some issues with sorting logic on a beforeFind() getting applied to constraints in the buildRules() when it should not be, on some legacy Cake 3 code I maintain. I was wondering if there is a better approach to implementing this than what I have in place. I wrote my question out with code samples on SO: |
# |
Jun 29th 2021, 16:42 |
umer936 |
Yes, i get it while developing on Windows with PHPStorm. Never figured how to fix so I just run phpcs manually instead |
# |
Jun 29th 2021, 16:04 |
japerlman |
@kevin.pfeifer Thanks for the feedback, I appreciate it. |
# |
Jun 29th 2021, 15:31 |
ndm |
You gotta be careful with the term "request", that could easily be interpreted as "HTTP request", but I guess you're most likely referring to invoking some kind of read operation on a query/result in one and the same HTTP request? An answer to your question probably depends on how you generate the result set, how/where you apply the mapping, if you possibly reassign results, etc... so a code example might help here. |
# |
Jun 29th 2021, 15:25 |
kevin.pfeifer |
@japerlman I would say either way is totally OK, it just depends what you/your customer prefers as a frontend experience and what you as a developer are more used to. |
# |
Jun 29th 2021, 15:23 |
dereuromark |
Well, it is possible the the intoduced warning is a bit too harsh for some use cases, sure |
# |
Jun 29th 2021, 15:22 |
slackebot |
react just because 'it is the modern way'. am I wasting my time and is there anything 'wrong' with just doing it 100% in cakephp like I've done previously? |
# |
Jun 29th 2021, 15:22 |
japerlman |
I have very limited experience in web app dev and want to make sure I'm not approaching things incorrectly. If you were making an app that is just mostly data in/data out forms and reports is there any benefit to doing the backend in cakephp and exposing the api to a react front end? I've done two apps in the past 100% in cakephp 2 and 3 and I'm struggling with all the extra work to do the backend in cakephp and the frontend in |
# |
Jun 29th 2021, 15:11 |
ndm |
Of course, I just don't see why it would be a problem in this specific case, unless the association is actually using a different target. Maybe I've overlooked that, and that is actually the case. |
# |
Jun 29th 2021, 15:07 |
dereuromark |
npm: Sure, if those were fullly identical. but you could configure them slightly different each time, and in that case it would silently use a different one than you might want. So I guess that might have been the reason for the warning and the core to be a bit more strict since 4.1+ |
# |
Jun 29th 2021, 15:05 |
ndm |
@conehead Did you check if using `getTarget()` makes a difference, like `$this->Users->Books->getTarget()->find()->...`? |
# |
Jun 29th 2021, 15:03 |
ndm |
Didn't follow the whole saga... but that looks a bit weird, why would using the same alias be a problem here when the parent is a different object? Shouldn't that work fine if the target/classname are the same? :thinking_face: |
# |
Jun 29th 2021, 14:35 |
dereuromark |
what we wish and reality often dont go hand in hand. While I agree with u, it is not feasible here, unfortunately |
# |
Jun 29th 2021, 14:34 |
conehead |
Not convenient to have: Users->contain(['UsersTags']); Employees->contain(['EmployeesTags']); I'd prefer to have: Users->contain(['Tags']); Employees->contain(['Tags']); and use some internal alias |
# |
Jun 29th 2021, 14:33 |
dereuromark |
thus the unique names here (aliases). |
# |
Jun 29th 2021, 14:33 |
dereuromark |
well, relations (assoc) have to be unique across the project to allow the registry to not confuse them. |
# |
Jun 29th 2021, 14:33 |
kevin.pfeifer |
yes |
# |
Jun 29th 2021, 14:33 |
conehead |
that sucks :P |