ehh ani tak ani tak.
Ciągle mam w konsoli ten sam błąd:
Poniżej lokalne wywołanie komendy:
damianoo@CampNou:/var/www/liga_typerow$ php app/console app:przypominajka
[Symfony\Component\Debug\Exception\ClassNotFoundException]
Attempted to load class "SoapClient" from the global namespace.
Did you forget a "use" statement?
Mam tak:
<?php
namespace AppBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use SoapClient;
class CronCommand extends ContainerAwareCommand{
protected function configure()
{
$this->setName('app:przypominajka')
->setDescription('Przypomnienie o typowaniu');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$doctrine = $this->getContainer()->get('doctrine');
$em = $doctrine->getEntityManager();
$matchdayObject = $em->getRepository('AppBundle:Matchday')->getMatchday();
// pobranie listy numerów tel. użytkowników, którzy jeszcze nie wytypowali
$usersPhones = $em->getRepository('AppBundle:Type')->getNoTypedUsersList($matchdayObject['name']);
ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient("http://api.gsmservice.pl/soap/v2/gateway.php?wsdl");
$arAccount = array("login" => "mojlogin","pass" => "mojehaslo"); "recipients" => $usersPhones,
"message" => "FC Barcelona rządzi :) ",
"sender"=> "Damian",
"msgType" => 1,
"unicode" => false,
"sandbox" => false
));
// wysłanie smsów o ustalonym w CRON terminie
$client->SendSMS(array("account" => $arAccount,"messages"=> $arMessages))->return;
}
}
albo tak:
<?php
namespace AppBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class CronCommand extends ContainerAwareCommand{
protected function configure()
{
$this->setName('app:przypominajka')
->setDescription('Przypomnienie o typowaniu');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$doctrine = $this->getContainer()->get('doctrine');
$em = $doctrine->getEntityManager();
$matchdayObject = $em->getRepository('AppBundle:Matchday')->getMatchday();
// pobranie listy numerów tel. użytkowników, którzy jeszcze nie wytypowali
$usersPhones = $em->getRepository('AppBundle:Type')->getNoTypedUsersList($matchdayObject['name']);
ini_set("soap.wsdl_cache_enabled", "0"); $client = new \SoapClient("http://api.gsmservice.pl/soap/v2/gateway.php?wsdl");
$arAccount = array("login" => "mojlogin","pass" => "mojehaslo"); "recipients" => $usersPhones,
"message" => "FC Barcelona rządzi :) ",
"sender"=> "Damian",
"msgType" => 1,
"unicode" => false,
"sandbox" => false
));
// wysłanie smsów o ustalonym w CRON terminie
$client->SendSMS(array("account" => $arAccount,"messages"=> $arMessages))->return;
}
}
Mówicie że to klasa systemowa i nie ma namespace ... hmm coś chyba musi jednak być ... można to jakoś zddebuggować żeby zweryfikować jak z Symfony powinienem się do tego dobrać ?
PS. Wyczyściłem dokładnie cache aplikacji.
Ten post edytował damianooo 23.11.2017, 18:06:17