| @@ 32-45 (lines=14) @@ | ||
| 29 | * @param LoggerInterface $logger Optional: PSR-3 Logger |
|
| 30 | * @param string $table Optional: Database table name |
|
| 31 | */ |
|
| 32 | public function __construct(\PDO $pdo, LoggerInterface $logger = null, $table = null) |
|
| 33 | { |
|
| 34 | // Setup |
|
| 35 | $this->table = $table ?: $this->table; |
|
| 36 | $this->logger = $logger ?: new NullLogger; |
|
| 37 | ||
| 38 | ||
| 39 | // Prepare business |
|
| 40 | $sql = "INSERT INTO {$this->table} |
|
| 41 | (user_id, retailer_number) |
|
| 42 | VALUES (:user_id, :retailer_number)"; |
|
| 43 | ||
| 44 | $this->stmt = $pdo->prepare( $sql ); |
|
| 45 | } |
|
| 46 | ||
| 47 | ||
| 48 | /** |
|
| @@ 23-36 (lines=14) @@ | ||
| 20 | public $logger; |
|
| 21 | ||
| 22 | ||
| 23 | public function __construct (\PDO $pdo, LoggerInterface $logger = null, $table = null) |
|
| 24 | { |
|
| 25 | $this->logger = $logger ?: new NullLogger; |
|
| 26 | ||
| 27 | $this->table = $table ?: $this->table; |
|
| 28 | ||
| 29 | $sql = "SELECT retailer_number |
|
| 30 | FROM {$this->table} |
|
| 31 | WHERE user_id = :user_id |
|
| 32 | LIMIT 1"; |
|
| 33 | ||
| 34 | $this->stmt = $pdo->prepare( $sql ); |
|
| 35 | ||
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param int $user_id |
|