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
problem with fuel curl with file upload
Found your mistake: $curl->set_params([ 'form-data' => [ 'file' => new CURLFile(self::$UPLOAD_FILE, 'application/octet-stream'), ], ]); You …
Comment by
WanWizard
August 2016
permalink
problem with fuel curl with file upload
The upload class expect uploaded files to be in $_FILES, i.e. uploaded via a FILE input element of a HTTP POST. That error message means $_FILES was empty.
Comment by
WanWizard
August 2016
permalink
select
Remi, https://github.com/fuel/orm/commit/c25c6e6476ffe7974e9f12b91bd7f1bf114d0fea $products = static::query() ->select('*') ->select(array(DB::expr('available_stock > minimum_stock'), 'is_stock')) …
Comment by
WanWizard
August 2016
permalink
select
Correct, an ORM is not a query builder, it's a record to object modeler. You can run queries, but one of the things that is not supported is "inventing" new columns, which will cause issues with the data mapping, it is not implement…
Comment by
WanWizard
August 2016
permalink
select
Thought so, you can't define the alias on ORM queries. It's probably the best to see if the result ends up in the final objects, and if so, with what name, and use that to order. The ORM isn't really designed for stuff like this.
Comment by
WanWizard
August 2016
permalink
select
Ah, wait, this is an ORM query, not a DB query? Not sure if that supports manually given aliases. Can you dump the entire query, or check with the profiler, to see if the alias is present?
Comment by
WanWizard
August 2016
permalink
select
You have to make it a DB::expr(), something like: $products = static::query() ->select('*') ->select(array(DB::expr('available_stock > minimum_stock'), 'is_stock)) ->order_by('is_stock DESC'…
Comment by
WanWizard
August 2016
permalink
How to set status code in controller_template?
You mean the HTTP status code? A controller has a property called "response_status", so you can simply do $this->response_status = 403; This will be used when the Controllers' after() method constucts the Response object. Unless…
Comment by
WanWizard
August 2016
permalink
add custom value by key in view
Is that Model_User part of the Auth package? Or something you made yourself? If Auth, which driver are you using, Simpleauth or Ormauth?
Comment by
WanWizard
August 2016
permalink
Can we use inline routes with regular expression?
No, it doesn't work like that. $1 is a replacement parameter in the regex, and a closure isn't a replacement string you can use in a regex statement. What you can do is: 'xxx/:any' => function() { $x = Uri::segments(); $x[0]…
Comment by
WanWizard
August 2016
permalink
OIL migration with postgres fails
No. The default schema class is quite MySQL centric, someone needs to create a Postresql driver with a modified schema. Since 1.8, the new driver architecture made this possible, but we haven't worked on alternative drivers yet.
Comment by
WanWizard
August 2016
permalink
Changing the Input
Found it, should be fixed now.
Comment by
WanWizard
August 2016
permalink
Changing the Input
Shoot, forget it, I was testing it in an app that someone had overloaded the Log class in, so I was testing the wrong code. I can reproduce it, thanks for reporting it.
Comment by
WanWizard
August 2016
permalink
Changing the Input
That should be the case, create_dir() can recursively create the directories that are needed. The old code could not, therefore there were two mkdir() calls, one for the rootpath, and one for the basepath. I just tested it with this app config: …
Comment by
WanWizard
August 2016
permalink
Changing the Input
That is odd, what exactly is the problem?
Comment by
WanWizard
August 2016
permalink
Changing the Input
Pushed experimental support for this to 1.9/develop: https://github.com/fuel/core/commit/614c196dfbe0810b8b7d657d1fc1d1089fa47cf7 This allows you to do: Request->forge('some/url') ->set_method('post') ->set_post(…
Comment by
WanWizard
August 2016
permalink
Changing the Input
Short answer is: you can't. One of the big problems with the current codebase is the use of static class methods, which make everything global. At the time of design it was assumed that you either call a controller method from the URL, or in…
Comment by
WanWizard
August 2016
permalink
An error occurs at log folder change
Has been fixed here: https://github.com/fuel/core/compare/8b07b26ab045...c4fe3b4caec7 You might need to switch to 1.9/develop or to backport it manually, pending a new hotfix release.
Comment by
WanWizard
August 2016
permalink
Save value into pivot table (Many to many relation)
Note that in a many-many query, through records aren't read and cached, the table is only used to create the join. So if you need both through table data and child table data, do something like: $result = Model_Student::query()-> where…
Comment by
WanWizard
July 2016
permalink
Save value into pivot table (Many to many relation)
If you save data in a "through" table, then technically it is no longer a many-to-many relation, it has become two one-to-many relations. So you can define it as such, a typical example: Student -> many_many -> Course (relation: co…
Comment by
WanWizard
July 2016
permalink
URL and japanese
Where exactly does it transform? What did you try and didn't work? As far as I can see, the URI class has no issue with any utf-8. As you say, Fuel is used a lot in Japan, if this would have been a framework issue, it would have been reported …
Comment by
WanWizard
July 2016
permalink
ucfirst
If you have an array with key => value, you can use: $new_array = array_map('ucfirst', $old_array); to make all values ucfirst.
Comment by
WanWizard
July 2016
permalink
Cascade restore does not work
Cool, thanks for the feedback. I'll commit the fix for Model_Soft later today.
Comment by
WanWizard
July 2016
permalink
Cascade restore does not work
Do you have the restore cascade defined on both relations? If so, it could be that you're now in an update loop (A->B->A...), Frozen means an update is being updated at the moment, so new updates are allowed, which could happen if it ca…
Comment by
WanWizard
July 2016
permalink
Cascade restore does not work
Ah, shoot, think I found it. foreach ($rel->get($this) as $model) { $model->restore($cascade_restore); } assumes that get() returns an array you can iterate over. But for singular relations like HasOne, it returns a single object. Can y…
Comment by
WanWizard
July 2016
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,368
Last Active
11:42AM
Roles
Administrator