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
Restfull API, with Form
You can't. FuelPHP is designed to work with URI segments, not with GET variables. Extra URI segments are passed on as arguments for the action called. So if your URL is http:localhost:8888/api/infos/2, $id will contain "2". If you …
Comment by
WanWizard
May 2015
permalink
Model_Soft and Many to Many relationship not cooperating.
Just to make sure I understand: You have a parent-child relation, both models based on Model_Soft. You do $parent->delete(), which soft-deletes the parent, and resets the foreign key of the associated children on a cascade_delete(), instead of …
Comment by
WanWizard
May 2015
permalink
Restfull API, with Form
I don't understand the question. What does a URL with GET variables have to do with ORM?
Comment by
WanWizard
May 2015
permalink
The session data stored by the application in the cookie exceeds 4Kb
There is a limit to how large a HTTP header can become (and a cookie is an HTTP header entry), which is dictated by the browser. To avoid your application weirdly crashing, Fuel checks if the size doesn't exceed 4Kb, which is a common cross-br…
Comment by
WanWizard
May 2015
permalink
Help me please with recursive deletion
Nothing on a delete can be new, causing an insert. Unless you have assigned it yourself before the delete. Again, Fuel doesn't "invent" new records.
Comment by
WanWizard
May 2015
permalink
Database selection
It does for MySQL via PDO, it doesn't for all other PDO drivers. If you use a different driver and need list_tables() support, create an issue at https://github.com/fuel/core/issues, stating the driver you use, and the SQL statement used to li…
Comment by
WanWizard
May 2015
permalink
array_to_attr and HTML5 valueless attributes
It was written with XHTML in mind, and never updated. I suggest to add an additional argument, to not break any backward compatibility: function array_to_attr($attr, $html5 = false) and then do something like this? // deal with null and bool val…
Comment by
WanWizard
May 2015
permalink
Bugsnag
Easiest is probably to overload Log::initialize() (since 1.8/dev). static::$monolog contains the Logger instance, you can add whatever handler you want to it. If your overloaded method calls the parent, it will add Fuel's own handler too, so y…
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
That is not SQL generated by Fuel's query builder. Or your db configuration is wrong, for MySQL and MariaDB, column names are generated between backticks. /** * Base PDO config */ 'default' => array( …
Comment by
WanWizard
April 2015
permalink
Help me please with recursive deletion
Fuel doesn't do that. So it must be something in your code that triggers this behaviour.
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
Why? If you want to use DB without the ORM abstraction layer, that code example I gave you should work perfectly fine...
Comment by
WanWizard
April 2015
permalink
Trying to get property of non-object
If //-->>error gives you that error, it means that $item->atktb is not an object. Which is quite possible, if that specific $item doesn't have a related atktb object. In that case it will be NULL. You need to test that before a…
Comment by
WanWizard
April 2015
permalink
Trying to get property of non-object
Without the code and the exact line that gives that error, it will only be guesswork.
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
Try to avoid DB::query(), use it as an absolute last resort. It is complex, it causes high-maintenance, and it is potentionally insecure. Instead, use $library = \DB::select("id", "title", "author", "type") …
Comment by
WanWizard
April 2015
permalink
Help me please with recursive deletion
ORM will never insert records on a delete, so you must be doing something funny. What can happen is that an UPDATE query is generated on a related table with 0 as the key, which happens if you define the relation the wrong way around. Besides that…
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
Have you enabled all error reporting? Have you enabled the profiler, and DB profiling? And what does that tell you? My guess: 'id' is ambiguous, you have two 'id' columns in the result, and I assume the author id overwrites the …
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
Something like: $results = DB::select() ->from('books') ->join('authors')->on('authors.id', '=', 'books.author_id') ->where('authors.type_id', '=', $type_…
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
You make it complicated for yourself, and you sacrifice security, your DB queries are not secure, you don't manually construct SQL anymore these days. But if you insist, nobody is stopping you. Al least use the DB query builder then, instead o…
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
When working with related tables, it's a lot easier to use the ORM: $query = Model_Book::query() ->related('author') ->related('author.type'); if ($id_author) { $query->where('id_author', …
Comment by
WanWizard
April 2015
permalink
Pagination problems, non-object errors
Also note that you are using input data without any validation, which from a security point of view is a bad idea...
Comment by
WanWizard
April 2015
permalink
Pagination problems, non-object errors
There is no property "off_set", so you should have had at least a notice error. I suggest you enable all error reporting, so you see all errors. You don't say what method call gives the error, nor the line and file that this call is …
Comment by
WanWizard
April 2015
permalink
How to put into and get from through table with many_many ralation?
If you have attributes in your through table, it's not a through table anymore, you have just created two one-to-many relations using three tables. And yes, that would require a third model. Note that you can have both relations active at the…
Comment by
WanWizard
April 2015
permalink
Foreach in function DB class
You are changing the loop variable of the foreach, which is always a copy, unless you use the & (by reference). If you do that, you will get an exception, since database results are read-only and can not be modified. Instead, I would have your…
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
Define it in the argument list with a default: public function get_movies($id, $date = null) { // do we have a date? if ($date) { // do something } // do we have a second argument if (func_num_args() == 2) { …
Comment by
WanWizard
April 2015
permalink
Restfull API, with Form
In terms of validation there is no difference, it is not more complex to execute a SQL injection attack via a URI segment.
Comment by
WanWizard
April 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
1:19PM
Roles
Administrator