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
Pass two variable with router
The router method gets passed two arguments: the first is the name of the action called, the second an array with parameters. Under normal circumstances you don't need a router, so you should check that first. If it turns out you do, you do so…
Comment by
WanWizard
April 2015
permalink
Static variable and Constant
You can get around it using: protected static $projects_images_folder; public static function _init() { static::$projects_images_folder = DOCROOT.'assets'.DS.'v1'.DS.'img'.DS.'projects'.DS; }
Comment by
WanWizard
April 2015
permalink
Alias for related table field
You use order_by('relation-name.column', 'order'), so in this case order_by('position.name', 'asc'), assuming that model has a column called 'name'. You don't give the exact error, so it is a b…
Comment by
WanWizard
April 2015
permalink
Remember_me is always on
remember-me is implemented through a session instance. And enabling a session instance will always create the cookie, regardless of it's content. The reason why you are still logged in when you re-open your browser is probably because your ses…
Comment by
WanWizard
April 2015
permalink
Can I set certain output format for REST?
You ALWAYS have to use a prefix. The reason for this is simple and two-fold, it avoids collisions with existing PHP function names (you can't have a method called 'list'), and it allows you to define methods that are not callable fro…
Comment by
WanWizard
April 2015
permalink
Can I set certain output format for REST?
You can, you don't have to. That is true for all controllers, it is a generic feature, not limited to REST. If a "{HTTP_METHOD}_name" method exists, it will be called instead of "action_name". It allows you to split GET an…
Comment by
WanWizard
April 2015
permalink
Help me with db connection
dsn is used with a PDO config, so with 'type' => 'pdo'. The other types, 'mysql' and 'mysqli' don't use the DSN, they use individual values: /** * Base PDO config */ 'default…
Comment by
WanWizard
April 2015
permalink
ORM subsequent delete, save model actions participating in same transaction
If you unset a related child object, and you subsequently save the parent, those related objects will be unlinked from the relation, but not deleted. If you want to delete them, you need to delete them seperately. If you want multiple ORM actions …
Comment by
WanWizard
April 2015
permalink
How can I remove {"message":"success"} ?
You mean you use a Fuel curl request to call a Fuel rest controller? The rest controller only injects a response in case of an error situation, and then it's accompagnied with a HTTP status other than 200. I can't find "message"…
Comment by
WanWizard
April 2015
permalink
How can I remove {"message":"success"} ?
You get that where? As part of the response?
Comment by
WanWizard
April 2015
permalink
Primary key on model cannot be changed.
Your trip-category relation is the wrong way around. Easiest to remember: the model that contains the foreign key must have the "belongs_to" part of the relation. category_id is in Trip, therefore that should have the belongs_to, not th…
Comment by
WanWizard
April 2015
permalink
How do i alter a model and its migration created with "oil g model"
Make sure your db.php configuration is ok, then run oil refine fromdb which shows you the different options available.
Comment by
WanWizard
March 2015
permalink
How do i alter a model and its migration created with "oil g model"
You can just create a second migration for it, containing the delta? See http://fuelphp.com/docs/packages/oil/generate.html#migrations for some magic migrations. And if your change is too complex, you can allways create a migration by hand, and ad…
Comment by
WanWizard
March 2015
permalink
orm cascade delete order
The same logic isn't executed before and after, the delete() method is called twice, once before, and once after the parent has been deleted. Ideally, you delete children before the parent, I don't know why Jelmer has chosen to do it the …
Comment by
WanWizard
March 2015
permalink
Ecommerce integration with FuelPHP
Not that I'm aware of. But it shouldn't be too difficult to integrate, your can use the fromdb task to generate models from existing database tables. You only need to add the relations manually.
Comment by
WanWizard
March 2015
permalink
orm cascade delete order
The delete() method on the relation objects is called twice, once before the parent is deleted, and once after. Some relations use this, but not all, like hasmany. The question is: why would you want to change it? What is the issue you are trying t…
Comment by
WanWizard
March 2015
permalink
Oil task through rest controller, response contains cli:write
Cli::write() writes, like echo does, to the output device. Normally for a task that is the console, but if you call it interactively (or through a rest service), the writes will be part of the output. You can remove this by wrapping the call to the…
Comment by
WanWizard
March 2015
permalink
Upload getting filename doesn't exist
Which Fuel version? And is the upload package up to date (see https://github.com/fuel/fuel/blob/1.7/master/composer.json#L138)?
Comment by
WanWizard
March 2015
permalink
Regex in Named parameters Routes?
It already is. :-)
Comment by
WanWizard
March 2015
permalink
Regex in Named parameters Routes?
That is not supported by the route syntax, but as a route is a regex, you can add your own. A route like ":lang" is replaced by "(?P.+?)", so you need to replace the ".+" with your custom regex. You can do a Debug::du…
Comment by
WanWizard
March 2015
permalink
How to install existing fuelphp project from repo?
That depends. The state of the database, the contents of the migrations table and the migrations.php config file needs to be in sync. If you create a new vhost and you load a dump of an existing database, you have to make sure the config file match…
Comment by
WanWizard
March 2015
permalink
Regex in Named parameters Routes?
Can you be more specific to what you exactly want? You want to accept "/en/something" and "/es/something" but not "/de/something"?
Comment by
WanWizard
March 2015
permalink
Search records with empty value with ORM
That ORM statement generates exactly that query. Single or double quotes are irrelevant. You can check that by dumping the last_query(), or by using the profiler (with DB profiling enabled).
Comment by
WanWizard
March 2015
permalink
viewing image outside assets/img folder
img() requires files to be in the asset/img folder. You can use the add_path() method to add additional paths, in this case to the type 'img'.
Comment by
WanWizard
March 2015
permalink
Validation when setting and saving nested models
Already responded. ;-) For other readers: https://github.com/fuel/core/issues/1853
Comment by
WanWizard
March 2015
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
5:54PM
Roles
Administrator