Log message #4049075

# At Username Text
# Jul 6th 2017, 18:23 jeremyharris you could do a very simple rule that just checks that it exists, e.g. $rules->add(function($entity) { return $this->Users->exists([‘username’ => $entity->username; ]) }, ‘usernameExists’);
# Jul 6th 2017, 18:23 devito making a invalid login table without calling the users table
# Jul 6th 2017, 18:22 devito I want to ensure a username exists in users table before i save the new record
# Jul 6th 2017, 18:21 jeremyharris what are you trying to do :P
# Jul 6th 2017, 18:21 jeremyharris waiiit nevermind ignore me
# Jul 6th 2017, 18:20 jeremyharris actually exists in uses arbitrary columns too
# Jul 6th 2017, 18:20 devito yea
# Jul 6th 2017, 18:20 jeremyharris sorry
# Jul 6th 2017, 18:20 jeremyharris oh exists in
# Jul 6th 2017, 18:19 jeremyharris it operates on a column currently. the example uses “email”
# Jul 6th 2017, 18:19 devito @jeremyharris do u know if theres a way to use existsin on a column instead of a PK? or Is this something i would need to make myself?
# Jul 6th 2017, 18:14 jeremyharris obinoob maybe switch to conditional validation instead? https://book.cakephp.org/3.0/en/core-libraries/validation.html#conditional-validation
# Jul 6th 2017, 18:11 jarard01 wow chronos is powerful!
# Jul 6th 2017, 18:10 obinoob I just want to run the add method only if notEmpty method fails is this possible?
# Jul 6th 2017, 18:08 obinoob https://gist.github.com/fccpt/839fc34c156ce0321c04c8045987665d
# Jul 6th 2017, 18:08 obinoob Hi again, so this code is part of the solution I've found for my earlier question here in channel, I needed to write a validation rule for a text field dependable on checkbox please take a look here
# Jul 6th 2017, 18:07 jeremyharris :rubberduck:
# Jul 6th 2017, 18:07 jarard01 grr
# Jul 6th 2017, 18:07 jeremyharris you need to import it at the top, use Cake\Chronos\Chronos
# Jul 6th 2017, 18:07 jarard01 use Cake\Chronos\Chronos;
# Jul 6th 2017, 18:07 jarard01 i ran composer to install
# Jul 6th 2017, 18:06 jarard01 Class 'App\Controller\Chronos' not found
# Jul 6th 2017, 18:06 jeremyharris the example is actually for a unique user :slightly_smiling_face:
# Jul 6th 2017, 18:06 jeremyharris @devito yep, that’s exactly what application rules are for: https://book.cakephp.org/3.0/en/orm/validation.html#applying-application-rules
# Jul 6th 2017, 18:05 devito on the table layer is there a way to see if a username exists before saving new record? trying to do an invlaid login table and I want to create a record only if its a valid username
# Jul 6th 2017, 18:02 sdevore @jarard01 https://book.cakephp.org/3.0/en/chronos.html#generating-differences
# Jul 6th 2017, 18:02 jeremyharris or use straight up php
# Jul 6th 2017, 18:02 jarard01 checking..
# Jul 6th 2017, 18:01 jeremyharris jarard01, yep, check out chronos
# Jul 6th 2017, 17:58 jarard01 are there any cake classes to calculate days between a period?
# Jul 6th 2017, 17:13 origamiwork btw, is the "<name>" next to slackebot the name of the user responding using slackebot?
# Jul 6th 2017, 17:01 radarhill logout after HttpSocket digest login - thanks! Any pointers?
# Jul 6th 2017, 16:59 aro looks around
# Jul 6th 2017, 16:55 origamiwork so /anyController/info/ would take you to the Info Controller rather than whatever "anyController" was
# Jul 6th 2017, 16:54 origamiwork @slackebot I think I understand what you're saying, but I'd want to be able to do it for all controllers at once, not just the users controller.
# Jul 6th 2017, 16:50 dereuromark isnt that /users/* then etc?
# Jul 6th 2017, 16:45 origamiwork Greetings everyone. Does anyone know if it's possible to use routing to override the controller if the second parameter in the url is a certain string? For example, if the second paramer is "info" it should always go to the "info" controller, no matter what the first parameter is (/users/view/123 = UsersController->View(123), /users/info/ = InfoController->Index())
# Jul 6th 2017, 16:15 jeremyharris if so, use collection methods as it is a collection
# Jul 6th 2017, 16:14 jeremyharris the sql result is a query in this case?
# Jul 6th 2017, 16:13 jarard01 is HASH the best way to extract a list of fields from an sql result
# Jul 6th 2017, 16:13 sathomsen @jeremyharris @cleptric Turns out it was a composer server side problem :slightly_smiling_face: