Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Disable metadata in Auth
  • Hi there,

    I have a fuel app v1.8 with the OrmAuth system. At some point I put custom properties in my user model, but theses are data that I don't want to be saved or anything, it's just for the current page. Beside, if I want them to be saved, I want to handle it myself.

    The problem ? It add sql requests to my page to fetch users_metadata table every time I do this. Please tell me there is a way to just disable this behavior. I don't use this mechanism at all, so a solution to complexly disable it would be fine. (Easier than duplicate the ormauth class in my app folder and change it from here).

  • Ok, The problem came from the fact I had to declare an orm relation for metadata in my users relation because Auth_User declare EAV and not doing it would lead to an error. I duplicated the Auth_User class in my app and removed the eav relation, so the issue is fixed I guess, even if I would have preferred not having to do so.
  • Retrieval is done using a join, which doesn't take up extra time when the metadata table is empty (the database engine knows this and won't access the disk).

    Afaik there are no automatic saves taking place, but there are some implicit saves (create_user, reset_password, login_hash) which might also automatically save the metadata present in the user object at that time.

    Without having tested it, you could try to extend (overload) the user model into \Model\Auth_User, and add 'cascade_save' => false to the $has_many definition for the metadata relation. That should prevent metadata begin saved automatically every time the user object is saved.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion