Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Hw13 #1149

wants to merge 2 commits into from

Conversation

vasilaki-t
Copy link

No description provided.


declare(strict_types=1);

include_once 'vendor/autoload.php';
Copy link

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');
Copy link

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();
Copy link

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()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Обратите внимание на текст задания:

Паттерн должен содержать метод массового получения информации из таблицы, результат которого возвращается в виде коллекции.

Вы возвращаете просто массив, а не коллекцию.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants