Here u see, i added a new user to database, i want to do something after adding a new user, such as storing user data to redis and so on..
I am thinking Listener
to do that .
The question is :
I got the entity in postPersist. but it's an object . I want to convert it to an array to store it.
public function postPersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
$em = $args->getEntityManager();
// var_dump($em->getRepository('AppBundle:YaUser')->find($entity->getUid()));
if($entity instanceof YaUser){
}
}
I can't use get_object_vars
btw. Because the entity
is private then i get empty
THX:)