TemKa_SD Posted October 25, 2018 Share Posted October 25, 2018 Здравствуйте. Пожалуйста, подскажите. На скрине, в функции collectUnscoredGames идет выборка данных, там есть поле category и оно передается в функцию выше, а моем случае нужно будет в execute таска. http://prntscr.com/lagw0k Как вот это вывести в функции выше? $stmt->execute(['category' => $this->category]); Link to comment Share on other sites More sharing options...
newbie Posted October 26, 2018 Share Posted October 26, 2018 там есть поле category и оно передается в функцию вышеНе вижу.Есть метод init, в котором устанавливается $this->category, в котором вызывается метод collectUnscoredGames, в котором используется $this->category Link to comment Share on other sites More sharing options...
TemKa_SD Posted October 26, 2018 Author Share Posted October 26, 2018 Я тогда вообще не понимаю, как устанавливаеться тут категория... Дошел до функции scorePlayers всё отлично, дальше глюки пошли, не могу разобраться (((BaseW3mmdStats.php Link to comment Share on other sites More sharing options...
newbie Posted October 26, 2018 Share Posted October 26, 2018 scorePlayers Этот метод тоже вызывается в init, в котором устанавливается $this->category Link to comment Share on other sites More sharing options...
TemKa_SD Posted October 26, 2018 Author Share Posted October 26, 2018 http://prntscr.com/lanc3dhttp://prntscr.com/lanc6g Что не так? Link to comment Share on other sites More sharing options...
newbie Posted October 26, 2018 Share Posted October 26, 2018 45 строкаЧто за переменная $category? Откуда она взялась? Link to comment Share on other sites More sharing options...
TemKa_SD Posted October 26, 2018 Author Share Posted October 26, 2018 http://prntscr.com/lanrts Link to comment Share on other sites More sharing options...
newbie Posted October 26, 2018 Share Posted October 26, 2018 protected $category = null;Это $this->category Link to comment Share on other sites More sharing options...
TemKa_SD Posted October 26, 2018 Author Share Posted October 26, 2018 (edited) http://prntscr.com/lanx04 Но этот файл нигде не подключается. Я не понимаю тоже, откуда она выбирается. По идее, должно от сюда collectUnscoredGames Edited October 26, 2018 by TemKa_SD Link to comment Share on other sites More sharing options...
newbie Posted October 26, 2018 Share Posted October 26, 2018 Какой файл?Я Вам объяснил /** * @var String */ protected $category = null; /** * @inheritdoc * @param String $category */ protected function init(OutputInterface $output, string $category) { $this->category = $category; ...... $gameIds = $this->collectUnscoredGames(); - Где-то в коде вызывается метод init, в который 2-ым параметром передается $category. Допустим "movies"- $this->category = $category; идет присваивание. До этого $this->category равно null. После $this->category равно "movies"- В collectUnscoredGames уже используется $this->category со значением "movies" Link to comment Share on other sites More sharing options...
TemKa_SD Posted October 26, 2018 Author Share Posted October 26, 2018 Вроде оно: http://prntscr.com/lao2ujМне кстати с этими файлами тоже не понятно, они находятся в папке с "Командами" как и мой основной файл, т.е это такие мини task'и, только они как-то взаимодействуют в основным таском. Как мне подключить такое? Т.е это вот основной таск подключается и в него передаются параметры?extends BaseW3mmdStatsLegionTDMega.php Link to comment Share on other sites More sharing options...
TemKa_SD Posted October 26, 2018 Author Share Posted October 26, 2018 Ну да, так и есть, здесь оно и подключается:http://prntscr.com/larcrg - это таск.http://prntscr.com/larcyx - это мини таски для конкретного раздела. Как это интегрировать в мой таск? Link to comment Share on other sites More sharing options...
newbie Posted October 28, 2018 Share Posted October 28, 2018 Создавайте отдельные таски Link to comment Share on other sites More sharing options...
TemKa_SD Posted October 28, 2018 Author Share Posted October 28, 2018 Прям полностью все функции переносить? Или можно как-то объединить два таска и выбирать нужные функции от туда. Link to comment Share on other sites More sharing options...
newbie Posted October 28, 2018 Share Posted October 28, 2018 Зачем что-то выбирать?Код задач (тасков) нигде больше не используется. Если у Вас есть 2 задачи, в которых используется одинаковые методы, создайте новый класс, в который перенесите эти методы. А после используйте этот класс в задачах. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now