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
8243
Activity
Type checking with ORM?
Orm doesn't do that, MySQL does that. The PHP MySQL library returns ALL results as string. The data_type property works together with the "Observer_Typing", so you need to add that to your model to make it work. Check http://docs.fue…
Comment by
WanWizard
December 2014
permalink
How to Write a controller for get data from table 2 with id table 1
Look into ORM. Create a model for your two tables, or use the 'oil refine fromdb' commandline command to generate them. Add the relation between the two (student has_many gradebooks, gradebook belongs_to student), and off you go. After t…
Comment by
WanWizard
December 2014
permalink
Something like Laravel's ViewComposer
So you want a global view variable? // for static values View::set_global('var', $value); // for variables or runtime execution View::bind_global('var', $value); Both will give you $var in every View.
Comment by
WanWizard
December 2014
permalink
How to show message without using session_flash
As said before, web applications are stateless. So if you do something in request A (for example process the POST of a login form), and you then redirect to another page (with will becode request B), you need a mechanism to pass information from A…
Comment by
WanWizard
December 2014
permalink
URL as param in a route
FuelPHP doesn't work with the URI QUERY_STRING, so that is not supported and will not work. It works with URI segments. Both the query string and the extension will be stripped from the URI before a routing decision is made. But it's sim…
Comment by
WanWizard
December 2014
permalink
How to Conver Base64 to image and save it in Fuelphp
In itself this is not secure, have you thought about that? It allows anyone to create a file on your server using a HTTP POST. Think about this, and use a File Area to make sure you limit the reach of the path to a specific directory.
Comment by
WanWizard
December 2014
permalink
How to Conver Base64 to image and save it in Fuelphp
How about http://stackoverflow.com/questions/11511511/how-to-save-a-png-image-server-side-from-a-base64-data-string ?
Comment by
WanWizard
December 2014
permalink
How to show message without using session_flash
echo "This is a message"; ? Or do you mean something else? If so, please explain what you are trying to do or what you want to achieve. In general, web applications are stateless, so if you want to pass something from one request to the …
Comment by
WanWizard
December 2014
permalink
Native session driver
Ah, you mean that. Yes, internally we have to. Because we need to support Redis for cache even if the PECL extension isn't present. As I said, the API is different, so the only way to solve that is to have a single class with a unified API, wh…
Comment by
WanWizard
November 2014
permalink
Native session driver
/data/home/hverton [hverton@catwoman] $ php -a Interactive shell php > var_dump(class_exists('Redis', false)); bool(true)
Comment by
WanWizard
November 2014
permalink
Native session driver
If class_exist('Redis', false) returns true, then the PECL extension should be used. You can simply test this in a bit of plain PHP. If it returns false (the class isn't loaded), it will alias Redis_Db.
Comment by
WanWizard
November 2014
permalink
Native session driver
https://github.com/fuel/core/blob/1.8/develop/classes/fuel.php#L198 Redis was renamed to Redis_Db in 1.6.1, just to make the PECL extension available.
Comment by
WanWizard
November 2014
permalink
Native session driver
Fuel v1 does that already. If the PECL extension is detected, the Redis class will be the PECL one, and the internal class can be accessed using Redis_Db. If the PECL extension is not present, Redis_Db is aliased to Redis. It would probably be pos…
Comment by
WanWizard
November 2014
permalink
How do you call another module when using themes and modules?
By not mixing these functions in the same controller, but keep them separated. You can use some clever generic routes to make stuff appear together while is isn't in real life, for example // maps /api/v1/user/get/1 to /user/api/v1/get/1 …
Comment by
WanWizard
November 2014
permalink
How do you call another module when using themes and modules?
Very detailed, great! I would like to add: 6) design your applications API carefully. Separate interactive controllers from widget controllers from REST or SOAP API controllers. If makes it easier to use base controllers, and not have to deal with…
Comment by
WanWizard
November 2014
permalink
ORM from subquery
It might fail to detect it can (and should) move the where() clause to the subquery because of your rather complex and/or nesting? If ->where('branch_id', 'IN', array_keys(\Session::get('pce_user.active_branches')…
Comment by
WanWizard
November 2014
permalink
How do you call another module when using themes and modules?
No, you're doing it wrong. All our apps work this way, they have a single controller in the app (called loader) which is routed to on all requests. It loads a widget list from the database for the requested URL, and uses HMVC calls to collect…
Comment by
WanWizard
November 2014
permalink
How do you call another module when using themes and modules?
I think you're mixing concepts. Packages contain classes, and those could, like the one's in the Fuel core, be called statically. Modules are front-end componente, containing controllers, which must be called through a Request. Obviously…
Comment by
WanWizard
November 2014
permalink
Update fuel 1.7.2 zip link
Haven't had time for it, sorry. Don't have much time for anything at the moment.
Comment by
WanWizard
November 2014
permalink
"related field" behavior in models
You're trying to make the ORM into something it isn't, so you're making it yourself very difficult. I can guarantee you you will never get this working properly. Relations are endless, so where does this stop? No to mention recursive…
Comment by
WanWizard
November 2014
permalink
"related field" behavior in models
That shouldn't be to difficult to implement? public function & get($property, array $conditions = array()) { try { return parent::get($property, $conditions); } catch (\OutOfBoundsException $e) { // conv…
Comment by
WanWizard
November 2014
permalink
"related field" behavior in models
What is exactly the problem? The relation exists, and "model_product->cat->name" gives you the category name. So all you want to do is to map the "cat_name" property to "cat->name"?
Comment by
WanWizard
November 2014
permalink
i18n in model fields
We use two different systems for i18n: For the application side of things, interface, etc, we have a cache layer on top of it, that creates data structures not unsimilar to lang files. This system deals with the downsides when you have volume. For…
Comment by
WanWizard
November 2014
permalink
Two differents Uri but One Action?
Routes are processed in the order they are defined. So always make sure more specific routes are defined before more generic ones. In other words, swap these two...
Comment by
WanWizard
November 2014
permalink
ORM from subquery
https://github.com/fuel/orm/archive/1.8/develop.zip
Comment by
WanWizard
November 2014
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,385
Last Active
9:51AM
Roles
Administrator