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
"Injecting" Fuel PHP into other applications (as I do with CodeIgniter)
Fuel doesn't work from a single object, so I would think it would be a lot more complex. I don't have a ready-made answer for you. You'll have to look at the public/index.php. If you set the constants required and loaded the app boot…
Comment by
WanWizard
April 2013
permalink
ORM - Deleting Related Models with Conditions
I think I saw fixes in that area in 1.6/develop. Could you check that version of the ORM package (should work fine with a 1.5.3 core)? If not already fixed, please create an issue for this at https://github.com/fuel/orm/issues.
Comment by
WanWizard
April 2013
permalink
Query building and caching expiration
The first parameter of cached() is the lifetime. For the Cache class, both null and false are valid values for lifetime (meaning "forever'' and "default"), but the cached() method checks for ! empty(), ruling both values o…
Comment by
WanWizard
April 2013
permalink
Many to many relation not saved for current user
No problem. Happy Easter (or what's left of it ;)).
Comment by
WanWizard
April 2013
permalink
Many to many relation not saved for current user
The query is run when there is something assigned to $this->roles, and it checks if a role is assigned to the user in the database. This logic is flawed.You're saving the user object (which is $this), so if $this->roles is empty, eith…
Comment by
WanWizard
April 2013
permalink
Many to many relation not saved for current user
All I can say is that if you disable this call in the before_save() event, your problem is solved. I didn't go into detail on what exactly is causing it, but the only logical cause is that static::query(). Nothing else in there would cause an …
Comment by
WanWizard
April 2013
permalink
Questions how to use fuel-nestedsets package
$tree->name = 'Value'; like for any other (ORM) object ?
Comment by
WanWizard
April 2013
permalink
Questions how to use fuel-nestedsets package
tree_new_root() only sets left, right and tree id's. It doesn't touch anything else in the object.
Comment by
WanWizard
April 2013
permalink
Many to many relation not saved for current user
Correction. It runs static::query()->related('roles')->get_one() which will return the the first user (which normally is the admin user I guess) and it's roles. Which causes that user object to be updated. Since ORM caches ob…
Comment by
WanWizard
April 2013
permalink
Many to many relation not saved for current user
It's not related to the first user, it's related to the current user, i.e. the user that is loaded by Warden. It should be fixed in Warden (that static::query() has to go), I leave it up to you how you handle that.
Comment by
WanWizard
April 2013
permalink
Many to many relation not saved for current user
Thanks for the files. Bug found, and Warden is to blame. When you save a user, a 'before_save' event kicks in inside the Warden user model, which calls _add_default_role(). This method runs an ORM query on the current user object. This…
Comment by
WanWizard
April 2013
permalink
Is it possible to set multiple ORM relations between two tables?
Just define them like normal (i.e. the array notation), specifying the correct keys to make the link.
Comment by
WanWizard
April 2013
permalink
Many to many relation not saved for current user
If you can put the tar or zip online somehwere, you can place the link here (I will let you know when I've downloaded it so you can remove it again), send it to me via email (see previous post) or via PM on IRC.
Comment by
WanWizard
April 2013
permalink
Questions how to use fuel-nestedsets package
tree_new_root() generates a new tree root with a unique tree id, so it you use a second table to create your tree id's, you should not use that method, but create the root node manually: $tree = Model_Tree::forge(array( 'left_id'…
Comment by
WanWizard
April 2013
permalink
Some issue by using fieldset in combination with ORM
find() is not going to disappear. find() without parameters or find(null) is no longer supported, for that you need to use query(). I personally pass the fieldset object itself, and run the build() in the view, but this should work fine too. add_…
Comment by
WanWizard
April 2013
permalink
How to provide data for nested overview?
Dropdowns need an array with key-value pairs, and a multi-dimensional array will automatically create optgroups. So getting that from an ORM structure will always mean some looping. I would use the same query and foreach structure as I showed before…
Comment by
WanWizard
March 2013
permalink
How to provide data for nested overview?
If you have ORM models, and your relations are defined properly, you can just fetch them and loop over them? No need to do any conversion if you just want to echo them out. In your Controller: // get all information $countries = Model_Country::que…
Comment by
WanWizard
March 2013
permalink
Many to many relation not saved for current user
If you're willing to zip your entire fuel install root and a dump of your database, and get it to me, I can have a look. You can reach me at wanwizardfuelphp.com or on IRC if you don't want it public.
Comment by
WanWizard
March 2013
permalink
How to provide data for nested overview?
I greatly depends on where this data comes from, and what you want to do with it. So it's not an easy to answer question.
Comment by
WanWizard
March 2013
permalink
Many to many relation not saved for current user
fuel/packages/orm/classes/model.php
Comment by
WanWizard
March 2013
permalink
Many to many relation not saved for current user
The data in $_original_model_ids comes from $this->_original_relations in the model. It is given a value in the method _update_original_relations(). That method is called from _update_original() and from get(), to update after a lazy load. A laz…
Comment by
WanWizard
March 2013
permalink
Many to many relation not saved for current user
The $user object passes $this->_original_relations[$rel_name] to it (that's where original_model_ids comes from). $rel_name is the name of the relations, in this case 'permissions'. This contains the list of related objects, fetch…
Comment by
WanWizard
March 2013
permalink
Many to many relation not saved for current user
I can't imagine. The $user you use, where does that come from? It is fetched from the (users) model in all cases, or does it come from somewhere else? Do you do something special for the current logged in user? Somewhere something must be dif…
Comment by
WanWizard
March 2013
permalink
Change generated tabulation to spaces
Change a lot of code and templates, as tabs are used everywhere, as per Fuel's coding standards.
Comment by
WanWizard
March 2013
permalink
Many to many relation not saved for current user
Absolutely clueless. I can't think of any reason why the record positiion in a table would affect inserting data in another table. The only thing I can think of is debugging the save method of the ORM's manymany class, and try to figure o…
Comment by
WanWizard
March 2013
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,369
Last Active
7:12AM
Roles
Administrator