# |
Feb 17th 2020, 21:30 |
FunkadelicRelic |
I have 3 models - [recommendations], [recommendationgroups] and [assessments] |
# |
Feb 17th 2020, 21:30 |
FunkadelicRelic |
Hey all - wondering if anyone can point me in the right direction on an issue I'm having. Well actually it's more my lack of understanding more than anything... |
# |
Feb 17th 2020, 19:42 |
jslamka5685 |
k |
# |
Feb 17th 2020, 19:42 |
challgren |
@jslamka5685 nope https://github.com/cakephp/cakephp/blob/master/src/View/View.php#L949 |
# |
Feb 17th 2020, 19:40 |
jslamka5685 |
Is there any way to use the $this->assign() view functionality for array data rather than string data? |
# |
Feb 17th 2020, 19:31 |
thomas078 |
makes sense. |
# |
Feb 17th 2020, 19:31 |
thomas078 |
Many thanks! |
# |
Feb 17th 2020, 19:31 |
challgren |
You would need to send Buyer-Id: 12345, 123456 |
# |
Feb 17th 2020, 19:31 |
challgren |
No multiple headers are not allowed unless you use a comma between the values |
# |
Feb 17th 2020, 19:31 |
thomas078 |
wrong approach? |
# |
Feb 17th 2020, 19:31 |
thomas078 |
So, what does that mean? :) |
# |
Feb 17th 2020, 19:28 |
challgren |
https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 |
# |
Feb 17th 2020, 19:28 |
slackebot |
in which header fields with the same field-name are received is therefore significant to the interpretation of the combined field value, and thus a proxy MUST NOT change the order of these field values when a message is forwarded” |
# |
Feb 17th 2020, 19:28 |
challgren |
“Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one “field-name: field-value” pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma. The order |
# |
Feb 17th 2020, 19:26 |
thomas078 |
for some reason i only receive the latter |
# |
Feb 17th 2020, 19:26 |
thomas078 |
Buyer-Id: 12345 Buyer-Id: 123456 |
# |
Feb 17th 2020, 19:26 |
thomas078 |
not sure if its nginx or php or cake. Im trying to send duplicate http headers. |
# |
Feb 17th 2020, 18:15 |
kiwi_74 |
@flashios09 ok, cool. Thanks. I'll look into that. Just wanted to see if the answer was already known. |
# |
Feb 17th 2020, 18:14 |
slackebot |
<flashios09> |
# |
Feb 17th 2020, 18:11 |
flashios09 |
@kiwi_74 try and see, the DEBUG KIT timer tab can help you |
# |
Feb 17th 2020, 18:01 |
kiwi_74 |
approach. |
# |
Feb 17th 2020, 18:01 |
kiwi_74 |
Hello everyone. Quick hypothetical question. Would there be any significant performance hit if you called `$this->loadModel(modelName)` for all the models used by a controller in the initialize() function of that controller, rather than in each individual function as needed? I'm just trying to figure out the advantages / disadvantages to each |
# |
Feb 17th 2020, 17:56 |
flashios09 |
`$routes->connect('/Roomtypes/view/:id', ['controller' => 'Roomtypes', 'action' => 'view']);` |
# |
Feb 17th 2020, 17:56 |
flashios09 |
the route inside `routes.php` |
# |
Feb 17th 2020, 17:54 |
slackebot |
$this->response = $result; } return $result; } /** * The view action * * @param \App\Model\Entity\Roomtype $roomtype The roomtype entity. * @return void */ public function view(Roomtype $roomtype) { debug($roomtype); die(); } }``` |
# |
Feb 17th 2020, 17:54 |
slackebot |
'action' => $request->getParam('action'), 'prefix' => $request->getParam('prefix') ?: '', 'plugin' => $request->getParam('plugin'), ]); } /** * @var callable $callable */ $callable = [$this, $request->getParam('action')]; $id = $request->getParam('id'); $pass = $request->getParam('pass'); if ($id) { $Table = |
# |
Feb 17th 2020, 17:54 |
slackebot |
TableRegistry::get($request->getParam('controller')); // you can replace the `get` method with a custom finder or a config option // you can merge the pass or overwrite it, this is just an example $pass[0] = $Table->get($id); } // $result = $callable(...array_values($request->getParam('pass'))); $result = $callable(...array_values($pass)); if ($result instanceof Response) { |
# |
Feb 17th 2020, 17:54 |
slackebot |
* @throws \ReflectionException */ public function invokeAction() { debug("invokeAction"); $request = $this->request; if (!$request) { throw new LogicException('No Request object configured. Cannot invoke action'); } if (!$this->isAction($request->getParam('action'))) { throw new MissingActionException([ 'controller' => $this->name . 'Controller', |
# |
Feb 17th 2020, 17:54 |
flashios09 |
```<?php namespace App\Controller; use App\Controller\AppController; use App\Model\Entity\Roomtype; use Cake\Controller\Exception\MissingActionException; use Cake\ORM\TableRegistry; use LogicException; /** * Roomtypes controller */ class RoomtypesController extends AppController { /** * Dispatches the controller action. Checks that the action * exists and isn't private. * * @return mixed The resulting response. |
# |
Feb 17th 2020, 17:54 |
flashios09 |
@chris301 @dan874 this is how you can have an entity with typehint as a passed param in your action, all you have to do is to play a little bit with the `Controller::invokeAction()` method |
# |
Feb 17th 2020, 17:12 |
neon1024 |
As a Cake controller would get the repository class instance automagically 8) |
# |
Feb 17th 2020, 17:11 |
neon1024 |
Perhaps the grey area is the separation between the repository instance and the entity |
# |
Feb 17th 2020, 17:11 |
neon1024 |
> application providing the model based on what it’s asked for |
# |
Feb 17th 2020, 17:07 |
admad |
what you want could be achieved relatively easily in Cake 4 by overriding Controller::getAction() and Controller::invokeAction() |
# |
Feb 17th 2020, 17:05 |
chris301 |
anyway, i’m clocking off for the day - thanks for your help guys - looks like what we’ve wanted to do isn’t possible |
# |
Feb 17th 2020, 17:05 |
chris301 |
to do what we have seen elsewhere, it wouldn’t be the router doing it - rather the application providing the model based on what it’s asked for. it’s interesting to see the differences between frameworks |
# |
Feb 17th 2020, 17:03 |
admad |
making the router pull out entities is muddling of concerns IMO |
# |
Feb 17th 2020, 17:01 |
chris301 |
we inherited this codebase, along with its problems, and have worked to make it a useable base - we are also behind on versions, due to other complications we’ve had along the way. it’s in the long term plan to update, but that hasn’t happened yet |
# |
Feb 17th 2020, 17:00 |
chris301 |
what we’re trying to do is separate out the concerns fully. as for replicating laravel with cake, theres things we’ve got in place to make our jobs easier but we know replicating laravel is nigh on impossible in cake |
# |
Feb 17th 2020, 16:58 |
chris301 |
so we have many of those already in place |
# |
Feb 17th 2020, 16:58 |
neon1024 |
`$this->Posts->find('newest')->find('byAuthor', ['author' => 'Dave'])->find('published');` |