39 $this->logger = $logger;
48 $statementName = __METHOD__;
50 $this->
dbManager->prepare($statementName,
" 53 INNER JOIN upload_packages up ON p.package_pk = up.package_fk 54 INNER JOIN upload_packages up2 ON p.package_pk = up2.package_fk 55 INNER JOIN upload u ON up2.upload_fk = u.upload_pk 56 WHERE up.upload_fk = $1 57 ORDER BY up2.upload_fk ASC");
58 $res = $this->
dbManager->execute($statementName, array($uploadId));
62 while ($row = $this->
dbManager->fetchArray($res)) {
63 $packageId = intval($row[
'package_pk']);
64 $packageName = $row[
'package_name'];
68 return $packageId > 0 ?
new Package($packageId, $packageName, $uploads) : null;
76 $statementName = __METHOD__;
79 "INSERT INTO package (package_name) VALUES($1) RETURNING package_pk",
80 array($packageName), $statementName);
81 return new Package(intval($row[
'package_pk']), $packageName, array());
90 $statementName = __METHOD__;
93 "INSERT INTO upload_packages (package_fk, upload_fk) VALUES($1, $2)");
94 $res = $this->
dbManager->execute($statementName, array($package->
getId(), $uploadId));
static createFromTable($row)
__construct(DbManager $dbManager, Logger $logger)
fo_dbManager * dbManager
fo_dbManager object
addUploadToPackage($uploadId, Package $package)
findPackageForUpload($uploadId)
createPackage($packageName)