I have a CakePHP Console Shell that works fine until a Model->afterFind()
tries to add some data to the results which includes adding links, which doesn't seem to work while being called from the Console.
Is there a way to test in the Model->afterFind()
callback function whether it's being called from a Console Shell, so that I can skip the troublesome section that I don't need anyway?
Thanks, Ian
I'm not too sure whether there's a Cake way to do it, but you can do it via regular PHP
if(php_sapi_name() == 'cli' && empty(getClientIP())) {
//running via CLI
} else {
//running normally
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With