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
where, when using related models and limit / offset with relation consistence
I can't comment without knowing the query. Is your where clause on a field in your primary model, or on a field in a related model?
Comment by
WanWizard
November 2014
permalink
where, when using related models and limit / offset with relation consistence
Not sure what the question is? You should get (at maximum) the first $mylimit records back from Mymodel that match the WHERE clause, with their related records.
Comment by
WanWizard
November 2014
permalink
Native session driver
Correct. It's a PHP only replacement, because not Fuel itself can not have external dependencies, and because in some environments, users are not able to install PECL extensions by themselfs. Don't forget, the PECL extension didn't e…
Comment by
WanWizard
November 2014
permalink
Native session driver
Yes. What do you mean by that? It comes from https://github.com/jdp/redisent/blob/master/src/redisent/Redis.php#L61
Comment by
WanWizard
November 2014
permalink
Native session driver
No, all Fuel drivers supports concurrency. Note that the downside of it is that they are not thread-safe, so you need to take that into account. The Redis PECL extension is an optional extension, so we can not expect it to be installed. Which is wh…
Comment by
WanWizard
November 2014
permalink
Language file loaded merged
For your info, Fuel v2 will support multiple languages concurrently, so it doesn't have this merge issue.
Comment by
WanWizard
November 2014
permalink
Native session driver
The problem with native sessions is that PHP keeps the session file open with an exclusive lock. Which means you can not do anything concurrently, all processes will need to wait until the lock is released. This may not be an issue in simple web ap…
Comment by
WanWizard
November 2014
permalink
Getting certain details only from many-to-many relationship
get() always returns an array, even if there is only one result. If you want a single result only (i.e. apply LIMIT 1 to the query), use get_one() instead. With get(), $user will be an array of objects, causing $user->books to fail with that err…
Comment by
WanWizard
November 2014
permalink
Native session driver
Having said that, all session drivers contain native session emulation, so your session data should be available in $_SESSION, and updates to it are written back to your session store of choice.
Comment by
WanWizard
November 2014
permalink
Native session driver
You know native sessions don't support concurrency? Which is one of the reasons no native session driver was ever created. It brings your applications to a halt.
Comment by
WanWizard
November 2014
permalink
Getting certain details only from many-to-many relationship
That is not where ->get() is needed, it's in your query: if ($user = Model_User::query()->related('books')->where('id', '=', $user_id)->get()) { $books = $user->books; }
Comment by
WanWizard
November 2014
permalink
Language file loaded merged
There is currently no support for multiple concurrent languages, there is only one Lang object, containing a single multi-dimensional array to store the strings. Secondly, numeric keys are not supported in Lang and Config. Arr::merge() will not ove…
Comment by
WanWizard
November 2014
permalink
Regarding insert into many-to-many through-table
I'd say your relationship definition, because that is where it gets the column names from.
Comment by
WanWizard
November 2014
permalink
orm relationship
Correct. A "find one" returns the object find, a "find many" returns an array of objects. Even if the result is only one object.
Comment by
WanWizard
November 2014
permalink
Regarding insert into many-to-many through-table
That is not correct, it should be $user->posts[] = Model_Post::find(1);assuming the relation from users to posts is called 'posts'. So this line says "Assign the result of the find operation to the many relation between users and p…
Comment by
WanWizard
November 2014
permalink
Insert null into int field but got 0.
Ok, cool you found the problem.
Comment by
WanWizard
November 2014
permalink
FuelPHP memory use
That's the same as asking for the approximate maximum speed for a car. I differs greatly on design and specifications. We build corporate applications, so they tend to be more complex and heavy than your avarage website. If I look at one of t…
Comment by
WanWizard
November 2014
permalink
Insert null into int field but got 0.
Did you do what I asked? if you don't pass a column and a value to insert(), it will not be part of the INSERT statement. So it's either your code, or your DB engine. And you're not going to find out which if you don't debug.
Comment by
WanWizard
November 2014
permalink
FuelPHP memory use
ORM isn't designed for batch operations (= large amounts of data), it is designed for interactive use and lists. It caches every model object, so if you load lots of records, memory consumption will quickly go up. For bulk operations it's…
Comment by
WanWizard
November 2014
permalink
Insert null into int field but got 0.
DB:insert() doesn't invent values. Start by dumping the generated insert query after the insert using echo \Debug::dump(\DB::last_query()); Is the order_id column present? And what value is it set to? Is it in $data?
Comment by
WanWizard
November 2014
permalink
A dumb question about many-to-many models
Correct. You define the relations between the models, ORM is smart enough to know there is a junction or relation table (either determined from the model names, or because you specify the table in the relation). You only need the additional model i…
Comment by
WanWizard
November 2014
permalink
[SOLVED] XMLHttpRequest for Upload file
You get that error if $_FILES is empty. So something isn't going right with that POST...
Comment by
WanWizard
November 2014
permalink
Using Migration from Auth Package
These are Ormauth tables, created by the migrations in the Auth package. You need to populate these manually, using the ORM user objects also present in the Auth package.
Comment by
WanWizard
November 2014
permalink
Best method for implementing two dashboards and one main page
There are many ways to solve this, and i don't think there is one single "best practice". Most of it depends on how modular and separated you want things to be, how complex you want to make it, how big the application is, how many p…
Comment by
WanWizard
November 2014
permalink
Ordering model query according to it's has_many relation
No. That would require a select with a subquery, and that is not supported. As a workaround you could: - run your query including the related has-many - loop over the result, and store the count of the related records in a custom variable - sort th…
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,399
Last Active
3:29AM
Roles
Administrator