Guessing you have a constructor in your user class? Because the salt is set in the constructor of the base User class.
// FOS\UserBundle\Model\User
public function __construct()
{
$this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
$this->enabled = false;
$this->locked = false;
$this->expired = false;
$this->roles = array();
$this->credentialsExpired = false;
}
If you have your own constructor don't forget to call the parent constructor with parent::__construct()
to get it working. See also in the FOSUserBundle docs, where the call to the parent constructor is mentioned.
From the PHP docs: Parent constructors are not called implicitly if the child class defines a constructor. In order to run a parent constructor, a call to parent::__construct() within the child constructor is required. If the child does not define a constructor then it may be inherited from the parent class just like a normal class method (if it was not declared as private).