/** * @param UserBindingModel $user * @throws \Exception */ public static function add(UserBindingModel $user) { if ($user->getId()) { throw new \Exception('This entity is not new'); } if (self::exists($user->getUsername())) { throw new \Exception("User already registered"); } self::$insertObjectPool[] = $user; }