# |
Jan 3rd 2019, 18:18 |
jamison |
Docs still say best way to access logged-in user outside of controller context is `AuthComponent::user()`, however in 3.7 this method is no longer static. What's everyone using these days? |
# |
Jan 3rd 2019, 18:04 |
dereuromark |
hey, to all plugin developers: do you have prefer lowest check yet in travis? Also useful then: https://github.com/dereuromark/cakephp-queue/pull/206 to assert that you actually test those minimum constraints. |
# |
Jan 3rd 2019, 17:29 |
a.francazi |
oh now i got it, url should have been /review-votes/* and not /reviewvotes/ :slightly_smiling_face: |
# |
Jan 3rd 2019, 17:22 |
a.francazi |
I made a new table review_votes and baked a model and a controller with bake. (ReviewVotesTable, ReviewVote (Entity), ReviewVotesController) When I now try to access $this->ReviewVotes in the controller it gives me false, so I cant do $this->ReviewVotes->newEntity() and all that. What did I do wrong? It usually worked everytime |
# |
Jan 3rd 2019, 17:09 |
jeremyharris |
yes |
# |
Jan 3rd 2019, 17:08 |
Martin` |
is it possible to change the request object in a middleware? |
# |
Jan 3rd 2019, 16:45 |
richardd |
thank you Jeremy! I'm going to give it a try |
# |
Jan 3rd 2019, 16:45 |
murat |
I have an action that has just one `var_dump()` call in it. When I access it through its URL I see the printed output, but when I make an AJAX call to it I get an empty response. What am I doing wrong? |
# |
Jan 3rd 2019, 16:40 |
jeremyharris |
maybe you need to use loadModel first |
# |
Jan 3rd 2019, 16:40 |
jeremyharris |
oh I misread the error. it’s caused by Category not being on that class |
# |
Jan 3rd 2019, 16:37 |
jeremyharris |
in 2.0 it’s read() if I’m remembering right |
# |
Jan 3rd 2019, 16:37 |
jeremyharris |
2.0 doesn’t have a get() method on the model. perhaps you’re thinking of 3.0? |
# |
Jan 3rd 2019, 16:31 |
richardd |
Error: Call to a member function get() on null function index($parent_id = null) { if (empty($parent_id) andand empty($this->params['slug'])) { ->>> this is where the error is being reported ->>>>> $parent_id = $this->Category->get('defaultParentId'); } elseif (!empty($this->params['slug'])) { $parent_id = $this->Category->field('id', array('slug' => $this->params['slug'])); } |
# |
Jan 3rd 2019, 16:30 |
richardd |
I am trying to upgrade from cake1.3 to cake2.0 using the manual, I have moved my controllers, views and models over and can't get past this error |
# |
Jan 3rd 2019, 16:30 |
yamcomnet |
thanks again @jeremyharris |
# |
Jan 3rd 2019, 16:29 |
yamcomnet |
ok. that makes sense then |
# |
Jan 3rd 2019, 16:27 |
jeremyharris |
as per the docs, the CSRF protection is only for PATCH, POST, PUT, or DELETE |
# |
Jan 3rd 2019, 16:27 |
yamcomnet |
or Ajax |
# |
Jan 3rd 2019, 16:27 |
yamcomnet |
ok. seems that it works on POST requests but not on GET |
# |
Jan 3rd 2019, 16:18 |
yamcomnet |
ok. will test |
# |
Jan 3rd 2019, 16:13 |
jeremyharris |
what kind of test? if you just want to test via the browser, change the token and it will blackhole. or, POST without a token |
# |
Jan 3rd 2019, 16:12 |
yamcomnet |
hmm. what is the easiest way to test if Csrf middleware works? |
# |
Jan 3rd 2019, 16:05 |
ricksaccous |
who knows |
# |
Jan 3rd 2019, 16:05 |
ricksaccous |
might be able to just copy paste stuff |
# |
Jan 3rd 2019, 16:05 |
ricksaccous |
http://php.net/manual/en/function.version-compare.php#89416 |
# |
Jan 3rd 2019, 16:00 |
dereuromark |
Darn, everything you have to do yourself :P |
# |
Jan 3rd 2019, 16:00 |
jeremyharris |
I would as well, in composer |
# |
Jan 3rd 2019, 16:00 |
dereuromark |
i would expect to have sth in composer to normalize this |
# |
Jan 3rd 2019, 16:00 |
jeremyharris |
it’s for comparing PHP versions first and foremost |
# |
Jan 3rd 2019, 15:59 |
jeremyharris |
well your “o” is wrong based on the docs |
# |
Jan 3rd 2019, 15:59 |
dereuromark |
from a composer perspective they are the same |
# |
Jan 3rd 2019, 15:59 |
dereuromark |
thats nonsense imo |
# |
Jan 3rd 2019, 15:59 |
jeremyharris |
from SO: “You’re comparing one PHP-standardized version number string with one non-PHP-standardized version number string” https://stackoverflow.com/questions/10997482/php-version-compare-returns-1-when-comparing-5-2-and-5-2-0 |
# |
Jan 3rd 2019, 15:58 |
jeremyharris |
it is expected |
# |
Jan 3rd 2019, 15:57 |
dereuromark |
Same result for Comparator::equalTo() of composer, But I am fairly certain this is not correct.. |
# |
Jan 3rd 2019, 15:54 |
dereuromark |
is this a php bug? `1.4` and `1.4.0` should be equal right? version_compare($definedMinimum, $version, '=') for this says false? |
# |
Jan 3rd 2019, 14:52 |
jhall |
ok |
# |
Jan 3rd 2019, 14:52 |
dereuromark |
as for model validation. check if it is part of the incoming data in beforemarshall etc. then you could do it, otherwise this almost sounds like a domain validation |
# |
Jan 3rd 2019, 14:51 |
jhall |
ok |
# |
Jan 3rd 2019, 14:51 |
dereuromark |
one can easily disable that, making your validation fail semantically |
# |
Jan 3rd 2019, 14:51 |
dereuromark |
template and required attribute must never be the primary one. only syntactic sugar |