partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit f3f02dd6aad5abed6193df912b7f1bbe6cbfcea8
parent 795d350ed61f585b85b5959ad3af3a2e52d40447
Author: Felicitus <felicitus@felicitus.org>
Date:   Sat, 18 Jul 2015 03:45:38 +0200

Removed more obsolete code

Diffstat:
Dsrc/backend/PartKeepr/FootprintAttachment/FootprintAttachmentManager.php | 69---------------------------------------------------------------------
Dsrc/backend/PartKeepr/SiPrefix/SiPrefixManager.php | 75---------------------------------------------------------------------------
Dsrc/backend/PartKeepr/SiPrefix/SiPrefixService.php | 27---------------------------
3 files changed, 0 insertions(+), 171 deletions(-)

diff --git a/src/backend/PartKeepr/FootprintAttachment/FootprintAttachmentManager.php b/src/backend/PartKeepr/FootprintAttachment/FootprintAttachmentManager.php @@ -1,68 +0,0 @@ -<?php -namespace PartKeepr\FootprintAttachment; - -use PartKeepr\Util\Singleton, - \PartKeepr\FootprintBundle\Entity\Footprint, - PartKeepr\PartKeepr; - -class FootprintAttachmentManager extends Singleton { - /** - * Returns a list of footprint attachments - * - * @param int $start Start of the list, default 0 - * @param int $limit Number of users to list, default 10 - * @param string $sort The field to sort by, default "name" - * @param string $dir The direction to sort (ASC or DESC), default ASC - * @param string $filter The footprint id - */ - public function getFootprintAttachments ($start = 0, $limit = 10, $sort = "name", $dir = "asc", $filter = "") { - - $qb = PartKeepr::getEM()->createQueryBuilder(); - $qb->select("st")->from("PartKeepr\Footprint\FootprintAttachment","st") - ->leftJoin('st.footprint', "fp"); - - if ($filter != "") { - $footprint = Footprint::loadById($filter); - $qb = $qb->where("st.footprint = :footprint"); - $qb->setParameter("footprint", $footprint); - } - - if ($limit > -1) { - $qb->setMaxResults($limit); - $qb->setFirstResult($start); - } - - $qb->orderBy("st.".$sort, $dir); - - $query = $qb->getQuery(); - - $result = $query->getResult(); - - $totalQueryBuilder = PartKeepr::getEM()->createQueryBuilder(); - $totalQueryBuilder->select("COUNT(st.id)")->from("PartKeepr\Footprint\FootprintAttachment","st"); - - - - if ($filter != "") { - $totalQueryBuilder = $totalQueryBuilder->where("st.footprint = :footprint"); - $totalQueryBuilder->setParameter("footprint", $footprint); - } - - $totalQuery = $totalQueryBuilder->getQuery(); - - $aData = array(); - foreach ($result as $item) { - $aData[] = $item->serialize(); - } - return array("data" => $aData, "totalCount" => $totalQuery->getSingleScalarResult()); - } - - /** - * Returns a footprint attachment by id - * @param int $id The footprint attachment id - */ - public function getFootprintAttachment ($id) { - return FootprintAttachment::loadById($id); - } - -}- \ No newline at end of file diff --git a/src/backend/PartKeepr/SiPrefix/SiPrefixManager.php b/src/backend/PartKeepr/SiPrefix/SiPrefixManager.php @@ -1,74 +0,0 @@ -<?php -namespace PartKeepr\SiPrefix; - -use PartKeepr\Manager\AbstractManager; -use PartKeepr\Util\Singleton, - PartKeepr\PartKeepr; - -class SiPrefixManager extends AbstractManager { - /** - * Returns the FQCN for the target entity to operate on. - * - * @return string The FQCN, e.g. PartKeepr\Part - */ - public function getEntityName() - { - return 'PartKeepr\SiPrefixBundle\Entity\SiPrefix'; - } - - /** - * Returns all fields which need to appear in the getList ResultSet. - * - * @return array An array of all fields which should be returned - */ - public function getQueryFields() - { - return array("id", "symbol", "base", "exponent", "base"); - } - - /** - * Returns the default sort field - * - * @return string The default sort field - */ - public function getDefaultSortField() - { - return "symbol"; - } - - public $siPrefixSymbolCache = array(); - - // @todo fix legacy stuff below - public function getSiPrefixBySymbol ($symbol) { - if (!is_array($this->siPrefixSymbolCache) || count($this->siPrefixSymbolCache) == 0) { - $this->createSiPrefixSymbolCache(); - } - - foreach ($this->siPrefixSymbolCache as $entry) { - if ($entry->getSymbol() == $symbol) { - return $entry; - } - } - - throw new \Exception(sprintf("Symbol '%s' not found", $symbol)); - } - - private function createSiPrefixSymbolCache () { - $dql = "SELECT sip FROM PartKeepr\SiPrefixBundle\Entity\SiPrefix sip"; - $query = PartKeepr::getEM()->createQuery($dql); - - $this->siPrefixSymbolCache = $query->getResult(); - } - - public function siPrefixExists ($prefix) { - $dql = "SELECT COUNT(sip) FROM PartKeepr\SiPrefixBundle\Entity\SiPrefix sip WHERE sip.prefix = :prefix"; - $query = PartKeepr::getEM()->createQuery($dql); - $query->setParameter("prefix", $prefix); - - if ($query->getSingleScalarResult() == 0) { - return false; - } else { - return true; - } - } -}- \ No newline at end of file diff --git a/src/backend/PartKeepr/SiPrefix/SiPrefixService.php b/src/backend/PartKeepr/SiPrefix/SiPrefixService.php @@ -1,27 +0,0 @@ -<?php -namespace PartKeepr\SiPrefix; - -use PartKeepr\Service\RestfulService, - PartKeepr\Service\Service, - PartKeepr\PartKeepr, - PartKeepr\Session\SessionManager; - -class SiPrefixService extends Service implements RestfulService { - public function get () { - $query = PartKeepr::getEM()->createQuery("SELECT si.id, si.prefix, si.symbol, si.exponent FROM PartKeepr\SiPrefixBundle\Entity\SiPrefix si"); - - return array("data" => $query->getArrayResult()); - } - - public function create () { - throw new \Exception("Not yet implemented"); - } - - public function update () { - throw new \Exception("Not yet implemented"); - } - - public function destroy () { - throw new \Exception("Not yet implemented"); - } -}