# |
Jul 12th 2017, 15:45 |
jeremyharris |
or you can always debug($context) to see exactly what it’s getting |
# |
Jul 12th 2017, 15:45 |
jeremyharris |
jarard01 then it’s probably not right :P have you checked the docs? they show what is in $context: https://book.cakephp.org/3.0/en/core-libraries/validation.html |
# |
Jul 12th 2017, 15:45 |
ericadeefox |
FacebookSDKException, it is. |
# |
Jul 12th 2017, 15:44 |
jarard01 |
jeremy no |
# |
Jul 12th 2017, 15:44 |
ericadeefox |
`Session not active, could not load state.` |
# |
Jul 12th 2017, 15:44 |
jeremyharris |
jarard01 does it work? |
# |
Jul 12th 2017, 15:44 |
ericadeefox |
let me go grab it for you... |
# |
Jul 12th 2017, 15:43 |
jeremyharris |
@ericadeefox I wonder if we’re looking at the right thing. do you know exactly what exception is being thrown by FB |
# |
Jul 12th 2017, 15:43 |
jarard01 |
does this look like a correct conditional validation rule: https://gist.github.com/spacebiscuit/ad07583634b8d732ad532e7f429477f3 |
# |
Jul 12th 2017, 15:43 |
ericadeefox |
returns `true` |
# |
Jul 12th 2017, 15:42 |
ericadeefox |
uhhhh |
# |
Jul 12th 2017, 15:41 |
ericadeefox |
oh, in the _controller_? my bad lol |
# |
Jul 12th 2017, 15:41 |
jeremyharris |
in the controller? |
# |
Jul 12th 2017, 15:41 |
ericadeefox |
it's gonna throw me an error saying that `$request` doesn't exist. |
# |
Jul 12th 2017, 15:41 |
jlroberts |
i dont understand what debug() has to do with it at this time... I just want to be able to use cake shells from the Installer.php, it makes sense, you load up a project with composer, and then immediately get into plugin migrations |
# |
Jul 12th 2017, 15:41 |
jeremyharris |
@ericadeefox if you throw a dd($this->request->session()->started())` on the top of one of your get actions, what does it show? |
# |
Jul 12th 2017, 15:40 |
jeremyharris |
maybe, but would you want to always use Cake\Functions\debug() to call global functions ? |
# |
Jul 12th 2017, 15:40 |
jlroberts |
ive read about autoloaders, there is specifically a spot for functions.php |
# |
Jul 12th 2017, 15:39 |
jeremyharris |
since the functions don’t exist within a namespace, the autoloader wouldn’t be able to find and thus require the file for you |
# |
Jul 12th 2017, 15:39 |
jlroberts |
heh |
# |
Jul 12th 2017, 15:39 |
jlroberts |
perfect, thats awesome, i think its supposed to autoload the functions.php file too though |
# |
Jul 12th 2017, 15:39 |
ericadeefox |
so. ok. doing a `$this->get()` or `$this->post()` request doesn't start a session, seemingly. I started each test with a `$this->get()` request and each of them still threw me 500s. hmm. |
# |
Jul 12th 2017, 15:38 |
jeremyharris |
that is loaded with composer’s autoloader. underneath the hood, it simply reads the namespace and discovers where the file is (based on conventions agreed upon by the PSR), and require’s the file for you |
# |
Jul 12th 2017, 15:38 |
jlroberts |
if it doesnt bootstrap cake, then how does 'use Cake\Utility\Security;' get autoloaded? im just curious... |
# |
Jul 12th 2017, 15:37 |
jlroberts |
ok |
# |
Jul 12th 2017, 15:36 |
jeremyharris |
the installer doesn’t “bootstrap” cake for you. that bootstrap process is what require’s the file in question |
# |
Jul 12th 2017, 15:36 |
jlroberts |
but why is it not global in Installer.php is the question |
# |
Jul 12th 2017, 15:35 |
jeremyharris |
if they were in a namespace, we’d need to do something like Cake\debug($var) everytime. they’re global for convenience |
# |
Jul 12th 2017, 15:35 |
jeremyharris |
remove the function_exist calls and you’ll see everything works just fine in a typical request (it is not loaded multiple times) |
# |
Jul 12th 2017, 15:35 |
slackebot |
~ Ferrero Roche |
# |
Jul 12th 2017, 15:35 |
slackebot |
Command sent from Slack by neon1024: |
# |
Jul 12th 2017, 15:34 |
neon1024 |
“Monsieur, with this Composer you are really spoiling us” |
# |
Jul 12th 2017, 15:34 |
jeremyharris |
no I think those just exist so you can overwrite them if you want, or to prevent collision in the global namespace |
# |
Jul 12th 2017, 15:34 |
jlroberts |
but thats the point, everytime the autoloader fires, it has to include the functions.php file, hence if (!function_exists(.... in functions.php |
# |
Jul 12th 2017, 15:33 |
jeremyharris |
just typical PHP stuff here |
# |
Jul 12th 2017, 15:33 |
jeremyharris |
those functions are in the global namespace, so cake just uses require to bring them into the application |
# |
Jul 12th 2017, 15:33 |
jeremyharris |
but it doesn’t and can’t, as those functions aren’t in a namespace, so the autoloader couldn’t find it even if it wanted to |
# |
Jul 12th 2017, 15:32 |
jlroberts |
ok, so somewhere, there is an autoloader, that is autoloading classes, from what I understand, that same autoloader needs to autoload the functions.php file |
# |
Jul 12th 2017, 15:31 |
jeremyharris |
it’s `require_once` by cake during bootstrap |
# |
Jul 12th 2017, 15:31 |
jeremyharris |
I mean, it’s not autoloaded by PHP |
# |
Jul 12th 2017, 15:31 |
jeremyharris |
it’s not even autoloaded by cake |