Log message #4020752

# At Username Text
# Apr 27th 2017, 19:23 aaronds within your beforeFind, @siran, have a look at the implementation of \Cake\Database\Query, you'll see the protected $_parts variables holds a lot of info.
# Apr 27th 2017, 19:22 holisticnetworking Well. Being a search, that's a long story. However the Paginator is creating the pagination links.
# Apr 27th 2017, 19:22 siran aaronds: thanks. in what context is $this ?
# Apr 27th 2017, 19:22 btx @holisticnetworking what does the code generating those URLs look like?
# Apr 27th 2017, 19:20 holisticnetworking It is specifically the `limit` variable that is missing.
# Apr 27th 2017, 19:20 aaronds @siran, have a look at $this->_parts['where']
# Apr 27th 2017, 19:19 slackebot1 facet=andst%5B0%5D=5and sort=Clients.emailand direction=asc
# Apr 27th 2017, 19:19 slackebot1 fmt=invoicesand facet=andst%5B0%5D=5and sort=Invoices.idand direction=descand limit=50and saved_query=14 // Paginator URLs on the same page: <https://limsdev4.biotech.cornell.edu/c/invoices?selected_columns=Invoices.id%2CClients.last_name%2CClients.state%2CClients.country%2CClients.email%2CBPayment.country%2CBPayment.state%2CInvoices.external%2CJournal.id2%2CInvoices.grand_total%2CInvoices.amount_paid%2CInvoices.paid& fmt=invoices and_method=POSTand saved_query=14and
# Apr 27th 2017, 19:19 holisticnetworking Any idea why Paginator would suddenly drop some preset GET variables? Compare the two URLs, broken down for clarity: // Original https://limsdev4.biotech.cornell.edu/c/invoices?_method=POSTandsaved_query=andselected_columns=Invoices.id%2CClients.last_name%2CClients.state%2CClients.country%2CClients.email%2CBPayment.country%2CBPayment.state%2CInvoices.external%2CJournal.id2%2CInvoices.grand_total%2CInvoices.amount_paid%2CInvoices.paid
# Apr 27th 2017, 19:19 COLT_ why does php_pdo_sqlsrv.dll keeps asking me for ODBC driver 13 on Cake?
# Apr 27th 2017, 19:18 COLT_ someone pleasee help me get out of a doubt
# Apr 27th 2017, 19:17 siran in beforeFind I need to tweak the query and remove one of the where() conditions, is this possible?
# Apr 27th 2017, 19:15 siran given a $query object, how can I extract the where conditions that have been applied to it, is this possible?
# Apr 27th 2017, 19:15 siran hi all!
# Apr 27th 2017, 19:13 aaronds nice, like that. I'll have a play around with it tomorrow. Thanks for your help @btx.
# Apr 27th 2017, 19:13 btx @aaronds
# Apr 27th 2017, 19:11 btx aaronds - you could also actually override `Router` to provide the modified `::url` function - and in `url()` do your check and fall back to `parent::url()` if no tricky stuff needs doing
# Apr 27th 2017, 19:03 aaronds ugly, but it'll do for what I need it for
# Apr 27th 2017, 19:02 aaronds I suppose something to the effect of `if (in_array('UrlBuilder', class_uses(new App\Controller\Admin\DashboardsController())) { /* do stuff */ }` would be required, with the option to fall back to guessing via the native Router::url();
# Apr 27th 2017, 18:57 btx easier **
# Apr 27th 2017, 18:57 btx always makin things easy for future me :P
# Apr 27th 2017, 18:57 aaronds for sure
# Apr 27th 2017, 18:57 btx yeah but at least it will be doing it in one place globally, so if you ever need to add weird logic it will be easy to find where :)
# Apr 27th 2017, 18:56 aaronds That surely still needs to figure out namespace/prefix stuff in the same disgusting manner?
# Apr 27th 2017, 18:54 btx maybe something like a `Trait` that provides a method on the controller to build a url according to your app rules?
# Apr 27th 2017, 18:53 aaronds You're correct @btx, that would be a side effect
# Apr 27th 2017, 18:53 aaronds I suppose for now I'll just use ReflectionMethod or something to figure out what the prefix should be based on the namespace of the class. But this feels wrong and horrible, it just allows for automagicalabilities.
# Apr 27th 2017, 18:52 btx that would be almost 100% guaranteed to break tho if you ever need to overload a class provided by, ie., a plugin
# Apr 27th 2017, 18:51 btx hmm. not sure about that one lol
# Apr 27th 2017, 18:49 aaronds so, what that really needs, is `Router::url(['prefix' => $namespaceOfController, 'controller' => $controllerName, 'action' => 'bar']);`
# Apr 27th 2017, 18:48 aaronds @btx, I should have mentioned I'm attempting to do this given an instance of a controller >_<
# Apr 27th 2017, 18:45 btx sure , you can do something like `Router::url( ['prefix'=>false, 'controller'=>'Foo', 'action'=>'bar'] )` but if anything ever changes (e.g. if you need to overload FooController in the future, or nest it) you need to replace all occurances in your code.
# Apr 27th 2017, 18:45 aaronds I'm thinking something to the effect of Route::url(App\Controller\FooController, 'myAction');
# Apr 27th 2017, 18:43 aaronds @btx, I've already got some routes established using Route::prefix (in my case, it's an admin/ prefix), with the relevant controllers residing in App\Controller\Admin. Rather than hard coding named routes for each controller, is there not a way to generate a URL for a controller that is outside this prefix (e.g at /foo, residing in App\Controller\FooController)?
# Apr 27th 2017, 18:38 btx np
# Apr 27th 2017, 18:38 Leonardo_0112 btx: OK, thanks for the explanations ;)
# Apr 27th 2017, 18:37 btx @aaronds - one of the safest (imho) ways to generate urls is to use named routes (combinations of ‘_namePrefix’ and ‘_name’)
# Apr 27th 2017, 18:36 btx Dealer hasOne Store, Store belongsTo Dealers. So you need a `Stores.dealer_id` (and nothing needed in Dealers)
# Apr 27th 2017, 18:35 aaronds Hi all. Does anyone know the easiest possible way to generate a URL for a given controller + method, even if that controller happens to be in another namespace?
# Apr 27th 2017, 18:35 Leonardo_0112 btx: in my case, one Dealer has only one Store, but i decided to split in in two table (delaers and stores, intead just one). Which table receives the *_id? dealers or stores?
# Apr 27th 2017, 18:33 btx @Leonardo_0112 - hasOne would require the related table to have a `*_id` column in it. Only use that when model A has one and only one of model B. If a Dealer can have multiple stores then the relationship is Dealer hasMany Stores, Stores belongsTo Dealers