Welcome Guest, Not a member yet? Register   Sign In
Doctrine x and Codelgniter : postQuery Hook
#1

[eluser]Unknown[/eluser]
Hello guys,

I would like to add a hook in my user model which manipulates the query data.
For example it should check whether the user status is active and if not, set the username to anything else.

Therefore I would like to add a function in my user model:

Code:
// models/User.php

class User extends Doctrine_Record
{
    // ...

    public function postQuery($event)
    {
        $invoker = $event->getInvoker();

        if(!$invoker->active) { $invoker->username = 'any different username'; }
    }
}

Is there any possibility to do this or something similar? I've spent hours on this but don't get any solution.

Thanks a lot!




Theme © iAndrew 2016 - Forum software by © MyBB