# |
Jun 14th 2019, 21:09 |
rightscoreanalysis |
in another model table file I can reference the const with: ListingTable::TYPES['Sale']; |
# |
Jun 14th 2019, 21:08 |
rightscoreanalysis |
In my model table file I have a constant: const TYPES = ['Sale' => '1', 'Wanted' => '2']; |
# |
Jun 14th 2019, 18:01 |
fr3nch13 |
How I do it is I always keep server specific settings, and account settings like the api username/password/keys in the .env file, then use the env() function in the app.php. I use the .gitignore to keep the .env out of the git repo, and include the app.php in the repo. Example in app.php Configure::write([ ‘App’ => [ ‘Name’ => env(‘APP_NAME’, ‘default if not set’) ] ]); |
# |
Jun 14th 2019, 17:56 |
khalid |
And this error handler is a class in src/error |
# |
Jun 14th 2019, 17:56 |
khalid |
You mean from where I am throwing exception? That would be controller yes |
# |
Jun 14th 2019, 17:37 |
ashish_onmobile |
@khalid where are you throwing your exception in controller or else where |
# |
Jun 14th 2019, 17:04 |
khalid |
Any suggestions help would be appreciated |
# |
Jun 14th 2019, 17:04 |
khalid |
I even tried core error handler someone exceptions dont go to their display function too it goes upto constructor but not after |
# |
Jun 14th 2019, 14:55 |
khalid |
it doesn't go to these functions. |
# |
Jun 14th 2019, 14:55 |
slackebot1 |
_displayException($exception) { die('DIEING'); echo 'Theres has been an exception!'; } ``` |
# |
Jun 14th 2019, 14:55 |
khalid |
@admad Thanks for your reply, but I also tried it, but it doesn't seem to work or I am missing something so what I did was following. In bootstrap added my CustomErrorHandler and called register method (like it said in documentation). and in my CustomErrorHandler I have following ```public function _displayError($error, $debug) { die('DIEING'); echo 'There has been an error!'; } public function |
# |
Jun 14th 2019, 14:45 |
st.steinkuehler |
@scuadra Have you check the SQL-Log in Debug Kit? Most of the times this helps to check which SQL the ORM has generated for the database |
# |
Jun 14th 2019, 14:43 |
admad |
@khalid exception renderer only handles rendering of error responses. For your use case you use use custom error handler and/or custom exception middleware |
# |
Jun 14th 2019, 14:42 |
st.steinkuehler |
@scuadra This seems strange to me: `'count' => $this->find()->func()->count('*'),` |
# |
Jun 14th 2019, 14:36 |
khalid |
According to my understand it should go to CustomExceptionRenderer, where as for Errors its working fine, it goes to CustomExceptionRenderer but not for Exceptions. what I want is to Perform some actions on each Exception (SPL,Cake or Custom) like saving in database, sending email or something like this |
# |
Jun 14th 2019, 14:33 |
khalid |
H Guys I have generated a CustomExceptionRenderer, registered it in config/app.php, now when I am throwing an exception it is not going to Renderer but it goes to Core BaseErrorHandler and from there it set renderer and now sure what happen next. |
# |
Jun 14th 2019, 14:25 |
yamcomnet |
Matching does not work properly. not consistent. Sometimes finds correctly when return $q->where(['Payments.id' => '123456']); |
# |
Jun 14th 2019, 14:24 |
yamcomnet |
#Works Fine $p = $this->Entries->Payments->find() ->where(['type' => 'top-up']) ->limit(3) ->toArray() ; debug($p); #Does not Find Anything?? $test = $this->Entries->find('all',['contain' => ['Payments']]) ->limit(3); $testi = $test->matching('Payments', function($q){ return $q->where(['Payments.type' => 'top-up']); }); |
# |
Jun 14th 2019, 14:24 |
yamcomnet |
Very Strange Things happening. Cake 3.7.8. |
# |
Jun 14th 2019, 14:20 |
slackebot1 |
'YEAR(NewsArticles.date)' => 'DESC' ]) ->toArray(); |
# |
Jun 14th 2019, 14:20 |
scuadra |
How can I select an year from date in Cake 3. I have news_articles table and I want to find the number of articles for each year. I am doing the following: $this->find('all') ->select([ 'count' => $this->find()->func()->count('*'), 'YEAR(NewsArticles.date)' ]) ->where([ 'NewsArticles.date <=' => date('Y-m-d') ]) ->group('YEAR(NewsArticles.date)') ->order([ |
# |
Jun 14th 2019, 11:13 |
awi |
hm. I dont see there any errors |
# |
Jun 14th 2019, 11:02 |
neon1024 |
I tend to use `var_dump($entity->getErrors())` as I dont believe that DebutKit always displays them if they’re nested |
# |
Jun 14th 2019, 11:02 |
neon1024 |
They’re in the Entities errors property with a key of the table I think |
# |
Jun 14th 2019, 11:01 |
awi |
Does aqnyone know, where I do get model validation errors when I save associated data into BelongsToMany Table using through? |
# |
Jun 14th 2019, 10:37 |
berarma |
Thanks. Now I see all the options. |
# |
Jun 14th 2019, 10:23 |
steinkel |
@berarma there is a mailing list here https://nimb.ws/OjApmC see the bottom of the page at https://cakephp.org/ |
# |
Jun 14th 2019, 10:18 |
neon1024 |
@berarma If you go to cakephp.org and hover over the Community menu item on the right hand side it has links to things like the forum |
# |
Jun 14th 2019, 10:16 |
berarma |
I'm working on an alternative to templating languages and I want to build a cakephp plugin for it. Since I work alone I'd like to have some input from anyone interested. |
# |
Jun 14th 2019, 10:14 |
berarma |
I'll use the forums. |
# |
Jun 14th 2019, 10:13 |
berarma |
Thanks @steinkel, so there's no mailing list I guess. I think there was one some time ago. |
# |
Jun 14th 2019, 10:11 |
steinkel |
@berarma https://cakephp.org/pages/get-involved#getHelp |
# |
Jun 14th 2019, 09:57 |
berarma |
OMG, I didn't know there was a forum. I wonder why I never found it on google searches. Isn't it getting indexed? |
# |
Jun 14th 2019, 09:42 |
berarma |
Hi. Does CakePHP have a mailling list? |
# |
Jun 14th 2019, 09:33 |
neon1024 |
Oh I see, didn’t realise, sorry |
# |
Jun 14th 2019, 09:33 |
acosonic |
I'm still on 2 :slightly_smiling_face: but I guess I'll find it |
# |
Jun 14th 2019, 09:33 |
neon1024 |
What is not working in that for you? |
# |
Jun 14th 2019, 09:33 |
neon1024 |
https://book.cakephp.org/3.0/en/core-libraries/email.html#setting-headers |
# |
Jun 14th 2019, 09:32 |
acosonic |
I figured that one, now trying to add list-unsubscribe... |
# |
Jun 14th 2019, 09:32 |
acosonic |
@neon1024 yeah both worked |
# |
Jun 14th 2019, 09:30 |
neon1024 |
@acosonic I think with the Cake Email class you can use `$Email->emailFormat('both')` |