1

i am new to symfony2 and i am learning to use event listerners.

I have this code

/** @Entity @HasLifecycleCallbacks */
class User
{
    // ...

/** @ORM\PrePersist */

    public function setPassword()
    {


        $this->password = "EVENTS";
    }

Now do i need anything else as well to make this code work. i mean what else do i need to do for this to work

1 Answer 1

2

@HasLifecycleCallbacks = to notify Doctrine that this entity has entity life-cycle callback annotations set on at least one of its methods

Possible annotations on the methods

@PostLoad, @PrePersist, @PostPersist, @PreRemove, @PostRemove, @PreUpdate or @PostUpdate

So, your code is good enough.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.