# |
Jun 29th 2018, 13:52 |
josbeir |
there are a few ways |
# |
Jun 29th 2018, 13:51 |
josbeir |
check out the routing middleware |
# |
Jun 29th 2018, 13:51 |
itmpls |
you mean not in config/routes? |
# |
Jun 29th 2018, 13:50 |
itmpls |
i'm just not understanding how i'd "load up routes for that site dynamically" though - haven't messed much with custom routes or middleware in cake |
# |
Jun 29th 2018, 13:50 |
josbeir |
:) |
# |
Jun 29th 2018, 13:49 |
lorenzo |
@josbeir brave guy |
# |
Jun 29th 2018, 13:48 |
josbeir |
if you load then from a db its not needed |
# |
Jun 29th 2018, 13:48 |
josbeir |
the host param seems more of af hardcoded solution |
# |
Jun 29th 2018, 13:48 |
josbeir |
if a site is detected in your middleware, load up routes for that site dynamically, no host needed then |
# |
Jun 29th 2018, 13:47 |
josbeir |
@itmpls i would just pass in the matched hostname in your dynamtic routes like we talked before |
# |
Jun 29th 2018, 13:46 |
josbeir |
:,( |
# |
Jun 29th 2018, 13:45 |
josbeir |
i'm clearing the path for you by 1 year @lorenzo |
# |
Jun 29th 2018, 13:44 |
itmpls |
i.e. Router::scope('/', ['_host' > '*.domain.com'], function($routes) { $routes->connect('/', [], 'routeClass' => 'foo' ] ) } ); vs Router::scope('/', ['prefix' => $prefix], function($routes) { $routes->fallbacks('Subdomain.Route'); } ); |
# |
Jun 29th 2018, 13:36 |
lorenzo |
it’s actually great :slightly_smiling_face: |
# |
Jun 29th 2018, 13:35 |
itmpls |
question.. i'm doing subdomain routing and to register the custom route class it seems like I can either do it by a wildcard host or the prefix. cakephp-subdomains plugin uses the prefix, but why vs the host? |
# |
Jun 29th 2018, 13:33 |
itmpls |
it isn't so bad, right?? :slightly_smiling_face: |
# |
Jun 29th 2018, 13:33 |
itmpls |
haha |
# |
Jun 29th 2018, 13:33 |
itmpls |
and by that i mean the 30 club |
# |
Jun 29th 2018, 13:33 |
lorenzo |
nice! |
# |
Jun 29th 2018, 13:31 |
itmpls |
oh man |
# |
Jun 29th 2018, 13:31 |
itmpls |
nice. i'm going to join you soon. 29 now, couple days |
# |
Jun 29th 2018, 13:31 |
itmpls |
ah |
# |
Jun 29th 2018, 13:31 |
lorenzo |
33 |
# |
Jun 29th 2018, 13:30 |
itmpls |
@lorenzo how old are you now |
# |
Jun 29th 2018, 13:20 |
lorenzo |
thanks medes |
# |
Jun 29th 2018, 13:14 |
itmpls |
happy bday @lorenzo |
# |
Jun 29th 2018, 13:09 |
jhob |
just reading up on anonymous functions in PHP docs now! :slightly_smiling_face: |
# |
Jun 29th 2018, 12:58 |
josbeir |
now you are! ;) |
# |
Jun 29th 2018, 12:54 |
jhob |
thanks, wasn't familiar with the use syntax :slightly_smiling_face: |
# |
Jun 29th 2018, 12:49 |
josbeir |
$ladies = $collection->reject(function ($person, $key) use($var) { $var == .. |
# |
Jun 29th 2018, 12:47 |
jhob |
Apologies if this is a really basic question, but how do I pass a var to compare to the filter callback, e.g. (I want to pass $gender) `$collection = new Collection($people); $ladies = $collection->reject(function ($person, $key) { return $person->gender === $gender; });` |
# |
Jun 29th 2018, 12:36 |
jhob |
awesome, thank you! Looking at implementing this now |
# |
Jun 29th 2018, 12:36 |
josbeir |
:point_up: |
# |
Jun 29th 2018, 12:35 |
saeideng |
The inverse of `filter()` is `reject()` |
# |
Jun 29th 2018, 12:35 |
saeideng |
it is easy to use `reject()` here |
# |
Jun 29th 2018, 12:31 |
josbeir |
=>https://book.cakephp.org/3.0/en/core-libraries/collections.html#filtering => https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#modifying-results-with-map-reduce |
# |
Jun 29th 2018, 12:31 |
jhob |
Thanks. Did look at updating users but also nervous about breaking other stuff. Cheers for pointers. |
# |
Jun 29th 2018, 12:31 |
josbeir |
or just toArray() and unset() the key :P |
# |
Jun 29th 2018, 12:30 |
josbeir |
@jhob multiple choices, you can use map/reduce or use a collection method |
# |
Jun 29th 2018, 12:28 |
jhob |
How do I unset/remove a record from a Cake\ORM\ResultSet ? |
# |
Jun 29th 2018, 12:05 |
lorenzo |
thanks @josbeir |