Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
WanWizard
a.k.a. WanWizard
Discussions
4
Comments
8242
Activity
Code profiler in ajax
Thanks for the feedback, good you found the issue.
Comment by
WanWizard
August 2017
permalink
Check if a database index exists before creating or dropping
You can use DB::list_indexes() to get an array with all indexes defined on a table. Note that an entry is returned for every column in an index. If you have an index like: UNIQUE KEY `indexname` (`fieldA`,`fieldB`); the following is returned: array …
Comment by
WanWizard
August 2017
permalink
Error when change e-mail address in FuelPHP forum
Woops, sorry, made a typo (GetRoleById should have been GetByRoleId). Fixed now.
Comment by
WanWizard
August 2017
permalink
Code profiler in ajax
Reran the tests with $_SERVER['HTTP_ACCEPT'] set to "application/json, text/javascript, */*", and that selects the "json" return format without problems. So unfortunately I'm not any closer to finding out why that …
Comment by
WanWizard
August 2017
permalink
Code profiler in ajax
I'm not sure at all. If it works if you hardcode it, and doesn't if you don't, it's either the request that is wrong, or the processing of it. I've only tested sofar with "application/json", and that worked fine. …
Comment by
WanWizard
August 2017
permalink
Where is the fuel/core/config/config.php called?
No, why do you conclude that? 'config.php' is just a parameter, a string passed to the init() method. If you look at that method, you'll see it does: \Config::load($config); to load the config file passed. The reason it is configura…
Comment by
WanWizard
August 2017
permalink
Code profiler in ajax
Yes, it is (unless that is disabled in the config). The REST Controller does autodetection of the format in the router method (which the Hybrid Controller inherits). For how and in which order, see https://fuelphp.com/docs/general/controllers/rest.h…
Comment by
WanWizard
August 2017
permalink
Code profiler in ajax
So, root cause of the problem is that you return a "text/html" response on an ajax call, instead of an "application/json" response. Test code used: public function action_response($param = false){ $this->format = 'json…
Comment by
WanWizard
July 2017
permalink
Code profiler in ajax
Ok, first results: return $this->response($data, 403); and $this->response($data, 403);return; and return $data; all work, but return Response::forge($data); doesn't, it throws an exception as Response outputs HTML, and $data is an arra…
Comment by
WanWizard
July 2017
permalink
Code profiler in ajax
Ok, that means I can test it here, and should be able to see the same result.
Comment by
WanWizard
July 2017
permalink
Code profiler in ajax
The code snippet I posted doesn't check the accept header, it checks the header set in the Response. Just calling is_ajax() isn't sufficient, there are lots of other output formats that are not related to ajax calls, that also require prof…
Comment by
WanWizard
July 2017
permalink
Code profiler in ajax
According to the code: $headers = headers_list();$show = true; foreach ($headers as $header){ if (stripos($header, 'content-type') === 0 and stripos($header, 'text/html') === false) { $show = false; }} It should n…
Comment by
WanWizard
July 2017
permalink
Code profiler in ajax
Hmm, that shouldn't be the case. Please create an issue for it, I'll have a look in the meantime.
Comment by
WanWizard
July 2017
permalink
Adding Value to Fieldset-Select
Entirely up to you. Both the ORM and Model_Crud are made for crud operations, and aren't suitable for fetching specific data sets quickly. Both are object based, not data based, and ORM caches as well, taking a lot of memory if you are not car…
Comment by
WanWizard
July 2017
permalink
Adding Value to Fieldset-Select
If you want to populate a dropdown from a database table, it's better and faster to use a DB query: // start the dropdown with a "please select...." placeholder$data = array('' => __('global.please-select')); //…
Comment by
WanWizard
July 2017
permalink
List all available public methods for the defined class
Depending on your use-case, you might want to use $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC); to filter out protected and private methods. Also, getMethods() doesn't have the option to filter out static methods, so if you nee…
Comment by
WanWizard
July 2017
permalink
List all available public methods for the defined class
You can't do "new $class_name" for Controllers, Controllers have required constructor arguments. Instead, look at reflection if you need to inspect classes: http://php.net/manual/en/reflectionclass.getmethods.php
Comment by
WanWizard
July 2017
permalink
Input::post('var_perms'); | Form | $_POST
If you do it like this, you need to keep track of what checkboxes where defined. Assuming this is about an ORM relation assignment, and the checkbox id's represent the id' of the child objects, you need to do something like this: // get th…
Comment by
WanWizard
July 2017
permalink
Adding Value to Fieldset-Select
I don't understand that you mean. "behind what"? Adding a select over an array?
Comment by
WanWizard
July 2017
permalink
ACL | ORM | Group Permission
Logical it doesn't solve your problem, as your code is completly wrong. ORM calls don't return values, the work with objects. So after $perm->save(), you can access $perm->id (or whatever your primary key is).
Comment by
WanWizard
July 2017
permalink
ACL | ORM | Group Permission
A permission has three components:- the area- the permission- the action So you can have an area "admin", "forum", "clients", etc, that define high-level functionality in your application. Then within "admin",…
Comment by
WanWizard
July 2017
permalink
ACL | ORM | Group Permission
If I interpret your data correctly, you have an array in $var_perms, that contains one or more group id's, and for each id, an array of actions. In that case I don't understand your code, because the relation between group and permission i…
Comment by
WanWizard
July 2017
permalink
ACL | ORM | Group Permission
I've reformatted your code because I was missing a bracket, and posted it in the code bin: https://bin.fuelphp.com/snippet/view/OH (use this next time, much easier than posting it). Did I do it correctly?
Comment by
WanWizard
July 2017
permalink
Log::write with custom $level don't work like docs.
I believe that functionality was lost when we switched to Monolog, which doesn't support custom labels as far as I know. So unfortunately, the docs need adjusting on that point.
Comment by
WanWizard
July 2017
permalink
Parser package - share views between Javascript and PHP
Ok, will do. And thanks. ;-)
Comment by
WanWizard
July 2017
permalink
More Comments
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
About
Username
WanWizard
Joined
January 2011
Visits
2,367
Last Active
2:38PM
Roles
Administrator