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
Example of search form processing
You'll probably have to loop over the results, and for every result over the related images, to fill your array,
Comment by
WanWizard
April 2013
permalink
Example of search form processing
The return value of a REST method must be either an array, or null (nothing) in case you've used $this->response() to set the response value(s). You can not return ORM objects, the REST base controller doesn't know how to convert that …
Comment by
WanWizard
April 2013
permalink
ORM Model / Namespace question
No, all Fuel core classes are in the \Fuel\Core namespace, but are aliased to the global namespace, hence the leading backslash. So all Fuel classes require the leading backslash, unless you're using them in a class that is not namespaced (li…
Comment by
WanWizard
April 2013
permalink
ORM Model / Namespace question
Because of how the autoloader works, both Model_Airport and \Model\Airport point to the same file. Which notation you choose is personal preference, some prefer the namespaced approach. For a coding point of view, it doesn't matter, both work.
Comment by
WanWizard
April 2013
permalink
ORM Model / Namespace question
Sorry, copied your original class definition, but that isn't correct too: class Airport extends \Orm\Model {} It was missing the backslash in front of Orm.
Comment by
WanWizard
April 2013
permalink
Query Binding Problem Convert String automatically
1.6 now has DB::identifier() to solve this issue, DB::expr() disables all quoting, which is not a good solution. DB::identifier('user.id') will return `user`.`id` (if you're using MySQL), so properly quoted.
Comment by
WanWizard
April 2013
permalink
Oil migrate spitting out driver error
Looks like you haven't configured your sessions to use a database. Copy fuel/core/config/session.php to fuel/app/config, and modify it. 'driver' is the second item in that config file. You might want to look at the other config items…
Comment by
WanWizard
April 2013
permalink
Issue with pagination uri_segment
Then you're controller code is wrong, it doesn't seem to pick up the page number from the URL. Switching to a query string is a workaround, it doesn't fix the problem. The most logical option is to define the segments are controller…
Comment by
WanWizard
April 2013
permalink
Query Binding Problem Convert String automatically
Encapsulate the variables you pass in DB::expr(), which will prevent them being treated as strings.
Comment by
WanWizard
April 2013
permalink
Issue with pagination uri_segment
afaik there is nothing wrong with Pagination. What do you mean by "the pagination seem freezed nothing change"? With this URI the uri_segment must indeed be 5, it's the fifth segment that contains the page number.
Comment by
WanWizard
April 2013
permalink
Oil migrate spitting out driver error
I have no experience with XAMPP, but I've heard a lot of people complain about the php.ini problem. Best this is probably to do a search on your system for php.ini, figure out which one is the correct one (the one your apache module is using)…
Comment by
WanWizard
April 2013
permalink
ORM Model / Namespace question
Your class is called Model_Airport, so you need to use Model_Airport::somefunction(). You can put it in the Model namespace, like so namespace Model; class Airport extends Orm\Model {} but then you'll have to use \Model\Airport::somefunction(…
Comment by
WanWizard
April 2013
permalink
How to add new child for Nested Set Trees
You can't use save() on a new tree object. If you do, left- and right pointers will not be added, so the node will not be part of the tree. Instead, use one of the tree_new... methods to save the new node to a particular location in the tree.
Comment by
WanWizard
April 2013
permalink
How to add new child for Nested Set Trees
As for tree_dump_as_array(Array $attributes = array(), $skip_root = true, $hierarchical = false) you don't need to pass anything. The array allows you to select a subset of the properties of a node (for example only the 'id' and th…
Comment by
WanWizard
April 2013
permalink
How to add new child for Nested Set Trees
If the tree is empty (i.e. no records with a specific "tree_id" exists, you first need to call tree_new_root(), creating the tree root: $root = Model_Tree::forge(array('name' => 'Root'))->tree_new_root(); You al…
Comment by
WanWizard
April 2013
permalink
How to add new child for Nested Set Trees
You need the specific model object that will be the parent. The only way to get that object (this is unrelated to nested sets) is to do a find() on the PK. If you don't get a specific parent node first, how would it know where to insert the chi…
Comment by
WanWizard
April 2013
permalink
How to add new child for Nested Set Trees
I don't think there are any examples out there. I converted it from DM to Fuel almost two years ago because someone asked for it, and haven't really looked at it since. I've got it on my todo list to rework it, and add it to the ORM p…
Comment by
WanWizard
April 2013
permalink
How to add new child for Nested Set Trees
You have to understand that every node in the try is (must be) a different object. If you do $tree->tree_new_first_child_of($tree); then you're trying to make the root a child of itself. Mess is guaranteed. ;-) So you need two objects fo…
Comment by
WanWizard
April 2013
permalink
Search Form
What is it exactly what you want? I assumed you didn't know Fuel at all, so I gave you the suggestion to look at the scaffolding code generated by oil, which contains all components you need to build any kind of form and processing the form su…
Comment by
WanWizard
April 2013
permalink
Help designing relating models
It's an ajax call, so all data the request produces is send back as a reponse to the call. Redirects works by adding a HTTP Location header, which is never going to work since your browser didn't request anything, it will never see a resp…
Comment by
WanWizard
April 2013
permalink
ORM issue order_by, limit, offset, relations
ORM generates a standard join unless you have included limit() and offset(). Only then it uses a subquery. I don't really know why nested where's are skipped, but I think it has to do with the fact that all where clauses inside the group …
Comment by
WanWizard
April 2013
permalink
Search Form
That works the same as in any other application, with the difference that in plain PHP you would use $_POST, where as in Fuel you use Input::post(). A piece of generated scaffold code would show you exactly how this works, the monkey example from …
Comment by
WanWizard
April 2013
permalink
Help designing relating models
I don't really get this. You're sending data to the client (for display I assume), and once that's done you want to redirect to another page? So the user can't see the data that was requested? That query will return all users, w…
Comment by
WanWizard
April 2013
permalink
Oil migrate spitting out driver error
What happens a lot is that the php-cli binary uses a different php.ini than the sapi version running in your webserver. Which causes the PDO driver not to be available when on the commandline. You can easy check this by starting the oil console (…
Comment by
WanWizard
April 2013
permalink
subquery in select orm
Looked at the code, and indeed, you can't do that. You have to take into account that an ORM is not a query builder. It's make to allow object oriented access to your database. What exactly are you trying to do here? Count the number of…
Comment by
WanWizard
April 2013
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,369
Last Active
6:13PM
Roles
Administrator