Replace ObjectManager with EntityManagerInterface #335

This commit is contained in:
Kendrick Chan 2020-02-11 20:31:28 +08:00
parent d51a98a6a0
commit fb76cb0445
28 changed files with 55 additions and 57 deletions

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\JobOrder;
@ -17,9 +17,9 @@ class AdjustLongLatCommand extends Command
{
protected $em;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $em)
{
$this->em = $om;
$this->em = $em;
parent::__construct();
}

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Battery;
@ -18,7 +18,7 @@ class ComputeWarrantyExpiryDateCommand extends Command
protected $em;
protected $wh;
public function __construct(ObjectManager $em, WarrantyHandler $wh)
public function __construct(EntityManagerInterface $em, WarrantyHandler $wh)
{
$this->em = $em;
$this->wh = $wh;

View file

@ -8,7 +8,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Warranty;
use App\Entity\Customer;
@ -33,7 +33,7 @@ class CreateCustomerFromWarrantyCommand extends Command
protected $cvu_mfg_id;
protected $cvu_brand_id;
public function __construct(ObjectManager $em, $cvu_mfg_id, $cvu_brand_id)
public function __construct(EntityManagerInterface $em, $cvu_mfg_id, $cvu_brand_id)
{
$this->em = $em;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\JobOrder;
use App\Entity\JOEvent;
@ -22,7 +22,7 @@ class FulfillOldJobOrderCommand extends Command
{
protected $em;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\JobOrder;
use App\Entity\JOEvent;
@ -22,7 +22,7 @@ class FulfillPendingJobOrderCommand extends Command
{
protected $em;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\VehicleManufacturer;
use App\Entity\Vehicle;
@ -21,7 +21,7 @@ class GenerateBatteryCompatibilityCommand extends Command
protected $em;
protected $vmfg_index;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -10,7 +10,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\JobOrder;
use App\Entity\Warranty;
@ -25,7 +25,7 @@ class GenerateWarrantyFromJobOrderCommand extends Command
protected $sapbatt_hash;
protected $warranties_hash;
public function __construct(ObjectManager $em)
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use CrEOF\Spatial\PHP\Types\Geometry\Point;
use DateTime;
@ -30,7 +30,7 @@ class ImportBatteryPriceCommand extends Command
protected $em;
protected $size_index;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;
$this->size_index = [];

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Battery;
use App\Entity\BatteryManufacturer;
@ -27,7 +27,7 @@ class ImportCMBBatteryDataCommand extends Command
protected $bsize_hash;
protected $batt_hash;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\BatterySize;
@ -20,7 +20,7 @@ class ImportCMBBatteryTradeInPriceCommand extends Command
protected $bsize_hash;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\BatteryManufacturer;
use App\Entity\BatteryModel;
@ -50,7 +50,7 @@ class ImportCMBVehicleCompatibilityCommand extends Command
protected $vmanu_hash;
protected $vmake_hash;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use DateTime;
@ -49,7 +49,7 @@ class ImportCustomerCommand extends Command
protected $mfg_index;
protected $vehicle_index;
public function __construct(ObjectManager $em)
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
$this->populateMfgIndex();

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Warranty;
use App\Entity\Battery;
@ -44,7 +44,7 @@ class ImportLegacyJobOrderCommand extends Command
protected $row_max_field_size;
protected $data_max_field_size;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Outlet;
use App\Entity\Hub;
@ -19,7 +19,7 @@ class ImportOutletsCommand extends Command
{
private $object_manager;
public function __construct(ObjectManager $om, ValidatorInterface $validator)
public function __construct(EntityManagerInterface $om, ValidatorInterface $validator)
{
$this->object_manager = $om;
$this->validator = $validator;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use CrEOF\Spatial\PHP\Types\Geometry\Point;
use DateTime;
@ -34,7 +34,7 @@ class ImportPartnersCommand extends Command
protected $em;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\SAPBattery;
use App\Entity\SAPBatteryBrand;
@ -22,7 +22,7 @@ class ImportSAPBatteryCommand extends Command
private $batt_size_hash;
private $batt_brand_hash;
public function __construct(ObjectManager $em)
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
$this->initBatteryHash();

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use CrEOF\Spatial\PHP\Types\Geometry\Point;
use DateTime;
@ -35,7 +35,7 @@ class ImportVehicleBatteryCommand extends Command
protected $batt_index;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;
$this->vmfg_index = [];

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use CrEOF\Spatial\PHP\Types\Geometry\Point;
use DateTime;
@ -28,7 +28,7 @@ class ImportVehicleCompatibilityCommand extends Command
protected $bsize_index;
protected $b_index;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;
$this->vmfg_index = [];

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Vehicle;
@ -15,7 +15,7 @@ class MergeDuplicateVehiclesCommand extends Command
{
protected $em;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;

View file

@ -8,7 +8,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\DBAL\Connection;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Service\JobOrderCache;
use App\Entity\JobOrder;
use App\Ramcar\JOStatus;
@ -21,7 +21,7 @@ class RefreshJobOrderCacheCommand extends Command
protected $em;
protected $jo_cache;
public function __construct(ObjectManager $om, JobOrderCache $jo_cache)
public function __construct(EntityManagerInterface $om, JobOrderCache $jo_cache)
{
$this->em = $om;
$this->jo_cache = $jo_cache;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use DateTime;
@ -21,7 +21,7 @@ class ReportRiderTime extends Command
protected $jo_index;
protected $filtered_jo_index;
public function __construct(ObjectManager $em)
public function __construct(EntityManagerInterface $em)
{
$this->em = $em;

View file

@ -6,7 +6,7 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Service\RedisClientProvider;
@ -17,7 +17,7 @@ class SeedRiderSessionsCommand extends Command
protected $em;
protected $redis;
public function __construct(ObjectManager $om, RedisClientProvider $redis)
public function __construct(EntityManagerInterface $om, RedisClientProvider $redis)
{
$this->em = $om;
$this->redis = $redis->getRedisClient();

View file

@ -8,7 +8,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Customer;
use App\Entity\PrivacyPolicy;
@ -22,7 +22,7 @@ class SetCustomerPrivacyPolicyCommand extends Command
private $policy_third_party_id;
private $policy_mobile_id;
public function __construct(ObjectManager $om, $policy_promo,
public function __construct(EntityManagerInterface $om, $policy_promo,
$policy_third_party, $policy_mobile)
{
$this->em = $om;

View file

@ -7,8 +7,6 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use App\Service\APNSClient;
use DateTime;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\JobOrder;
@ -18,7 +18,7 @@ class UpdateCustomerVehicleBatteryCommand extends Command
protected $em;
protected $custvehicle_hash;
public function __construct(ObjectManager $om)
public function __construct(EntityManagerInterface $om)
{
$this->em = $om;
$this->custvehicle_hash = [];

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Warranty;
use App\Entity\CustomerVehicle;
@ -19,7 +19,7 @@ class UpdateCustomerVehicleWarrantyCommand extends Command
protected $em;
protected $wh;
public function __construct(ObjectManager $em, WarrantyHandler $wh)
public function __construct(EntityManagerInterface $em, WarrantyHandler $wh)
{
$this->em = $em;
$this->wh = $wh;

View file

@ -7,7 +7,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\Rider;
use App\Entity\Battery;
@ -20,7 +20,7 @@ class UploadCleanupCommand extends Command
private $encoder_factory;
private $object_manager;
public function __construct(ObjectManager $om, Filesystem $fs, FileUploader $uploader)
public function __construct(EntityManagerInterface $om, Filesystem $fs, FileUploader $uploader)
{
$this->object_manager = $om;
$this->filesystem = $fs;

View file

@ -8,7 +8,7 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\EntityManagerInterface;
use App\Entity\User;
use App\Entity\Role;
@ -18,7 +18,7 @@ class UserCreateCommand extends Command
private $encoder_factory;
private $object_manager;
public function __construct(EncoderFactoryInterface $ef, ObjectManager $om)
public function __construct(EncoderFactoryInterface $ef, EntityManagerInterface $om)
{
$this->encoder_factory = $ef;
$this->object_manager = $om;