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
Extra property in Many to Many relation
A models should have a primary key. It's by design, it's the only way to uniquely identify an object. With this query, $shop should contain one instance of Model_Shop, containing the object identified by $id. You can access the relation…
Comment by
WanWizard
November 2012
permalink
what is the best way to define more config profiles (define custom environments)?
I don't think anyone is stopping you from using FUEL_ENV=myspecialenvor \Fuel::$env = "myspecialenv";Afaik there is no check in the core code if the environment set is one of the 4 default values configured.
Comment by
WanWizard
November 2012
permalink
Foreach in a View?
Afaik it always returns a multidimensional array, no matter how many records are returned. And that is by design, it would be foolish to have to check when running a query if the result was a single array or a multi-dimensional array. If you only…
Comment by
WanWizard
November 2012
permalink
Validate field based on another fields setting
You can do that in the validation rule. "match_field" and "required_with" are two examples of existing validation rules that validate based on a second field value.
Comment by
WanWizard
November 2012
permalink
Using packages to include external library
If it contains multiple classes, you have to define those classes in the bootloader. If you don't, the autoloader will try to load it, causing this type of errors, since it's already loaded. Look in the core bootstrap, where that is done …
Comment by
WanWizard
November 2012
permalink
Extra property in Many to Many relation
It isn't a special relationship, so there's nothing special about implementing it. You only have to realise that a many-many relation with a through table is, from a database normalisation point of view, only a combination of two one-to-m…
Comment by
WanWizard
November 2012
permalink
Using packages to include external library
If I look in that file, it defines a class called "simple_html_dom_node", not "Parser". Did you rename it?
Comment by
WanWizard
November 2012
permalink
ORM Validation and international number formats
As I wrote: I convert the user input into a standard PHP number (1.211,25 to 1211.25) in my validation rule. I convert it back to the local number format in the view when I need to display it, or in case it's a fieldset form I update the val…
Comment by
WanWizard
November 2012
permalink
Problem with implements SMARTY
Depot uses the Theme class, it doesn't load views directly. So all views are in the themes folder, not in app/views. If the parser package is loaded, and you've installed Smarty, the Theme class should be able to work with Smarty template…
Comment by
WanWizard
November 2012
permalink
Why not provide a mechanism to generate code using oil by self rules.
What do you mean by "self rules"?
Comment by
WanWizard
November 2012
permalink
Oil Scaffolding with plural nouns
Good point, Oil docs in general are in need of improvement. We've been looking for someone willing to take that on, we're a bit short-staffed at the moment.
Comment by
WanWizard
November 2012
permalink
Oil Scaffolding with plural nouns
Not much we can do about that. The convention for generation is that you use singular words to generate, and not a plural one.
Comment by
WanWizard
November 2012
permalink
ORM on save escape
Cool. Glad you got it sorted. For the next time, you can quicky check if this is the case by adding '\Orm\Model' to the security whitelist in your config.php. If that solves the problem, View encoding is the cause of the problem.
Comment by
WanWizard
November 2012
permalink
ORM Validation and international number formats
I only store normalized data in the database. PHP internally calculates with decimal point as well, so storing a European format isn't a very smart thing to do. I use a generic validation rule to verify decimal numbers. It takes a number as pa…
Comment by
WanWizard
November 2012
permalink
Spelling in Oil Scaffold ?
That is done by Inflector::pluralize(). As it is used in applications too (for example in messages like "1 person likes this" or "2 people like this"), it aims to produce proper English.
Comment by
WanWizard
November 2012
permalink
Spelling in Oil Scaffold ?
Correct. And to be compleet, the convention is that a model name is singular ("Person") as a model object deals with one person, the table and the controller names are plural ("People") as they deal with multiple persons.
Comment by
WanWizard
November 2012
permalink
Display User Info on Every Page?
The Auth library uses that user_id field to determine if someone is logged in. If you remove that, the Auth functionality no longer works, and you have to maintain user state manually. And I don't understand you're second statement. The A…
Comment by
WanWizard
November 2012
permalink
Foreach in a View?
You can make your model method a lot shorter by using execute()->as_array(). It will return the result in an array, no more need for conversions. I would do the date conversion in the view, that's clearly presentation code. I don't see…
Comment by
WanWizard
November 2012
permalink
ORM on save escape
Time to show us exactly what you're doing in your code, because without that it will remain guesswork.
Comment by
WanWizard
November 2012
permalink
FuelPHP and Namespaces
Extending across namespaces isn't a problem at all, I do it all the time. So it must be related to what you do and how you do it. There is no real practice, using packages and modules makes stuff more reusable, but if you want them in your app…
Comment by
WanWizard
November 2012
permalink
Passing HTML in mustache
set_safe() is an alias for set('var', $var, false).
Comment by
WanWizard
November 2012
permalink
Passing HTML in mustache
Nothing wrong with this approach.
Comment by
WanWizard
November 2012
permalink
ORM related limit ignored
I can asure you, both limit and rows_limit work, I use them daily in my applications. I think it has to do with your understanding of the way find() works. You're passing $id to the find() which either returns 1 record if the $id matches a pr…
Comment by
WanWizard
November 2012
permalink
Fieldset / ORM / Related Model
Not automatically. You will have to define the form field type in the model properties as 'select', and then populate the form field options with the correct key/value pairs. This is an example: $form->field('chairman_id')-…
Comment by
WanWizard
November 2012
permalink
Uncaught exception with message date() - unsafe to rely on systems timezone
When using xAMP installations, you have to make sure both apache and the CLI uses the same php.ini, because by default they don't, causing all kinds of weird errors.
Comment by
WanWizard
November 2012
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,396
Last Active
July 9
Roles
Administrator