-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hw13 #1149
base: main
Are you sure you want to change the base?
Hw13 #1149
Conversation
|
||
declare(strict_types=1); | ||
|
||
include_once 'vendor/autoload.php'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправьте все замечания линтера.
*/ | ||
private static function getDB() | ||
{ | ||
return new \PDO('mysql:host=localhost;dbname=my_database', 'username', 'password'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно создать во вне и инъектировать как зависимость.
|
||
public static function getAllUsers() | ||
{ | ||
$db = self::getDB(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Массовая подгрузка идёт мимо identity map. В итоге я могу всё загрузить и потом запросить все данные по из id, и это повлечёт хождение в БД.
return new \PDO('mysql:host=localhost;dbname=my_database', 'username', 'password'); | ||
} | ||
|
||
public static function getAllUsers() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Обратите внимание на текст задания:
Паттерн должен содержать метод массового получения информации из таблицы, результат которого возвращается в виде коллекции.
Вы возвращаете просто массив, а не коллекцию.
No description provided.