public function __construct(Pdo $pdo)
 {
     parent::__construct();
     $this->pdo = $pdo;
 }
Exemplo n.º 2
0
 public function removeVendor(Vendor $vendor)
 {
     $sql = "DELETE FROM " . $this->getTablePrefix() . "vendor WHERE id = ?";
     $stmt = $this->pdo->prepare($sql);
     $stmt->execute(array($vendor->getId()));
 }
 private function parsePackageJson($json)
 {
     $package = new Package();
     $package->setCreatedAt(new \DateTime());
     $package->setUpdatedAt(new \DateTime());
     if (isset($json->name)) {
         list($vendorName, $packageName) = explode('/', $json->name, 2);
         $vendor = new Vendor();
         $vendor->setName($vendorName);
         $package->setName($packageName);
         $package->setVendor($vendor);
         $package->setFullname($json->name);
     }
     if (isset($json->description)) {
         $package->setDescription($json->description);
     }
     return $package;
 }