summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php')
-rw-r--r--admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php76
1 files changed, 76 insertions, 0 deletions
diff --git a/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php
new file mode 100644
index 00000000..5f7e0f2e
--- /dev/null
+++ b/admin/WebConsole3/backend/src/Opengnsys/ServerBundle/Repository/PartitionRepository.php
@@ -0,0 +1,76 @@
+<?php
+
+/*
+ * This file is part of the Opengnsys Project package.
+ *
+ * Created by Miguel Angel de Vega Alcantara on 01/10/18. <miguelangel.devega@sic.uhu.es>
+ * Copyright (c) 2015 Opengnsys. All rights reserved.
+ *
+ */
+
+namespace Opengnsys\ServerBundle\Repository;
+
+use Opengnsys\CoreBundle\Repository\BaseRepository;
+
+/**
+ * PartitionRepository
+ *
+ * This class was generated by the Doctrine ORM. Add your own custom
+ * repository methods below.
+ */
+class PartitionRepository extends BaseRepository
+{
+ public function findByObservable($term = "", $limit = null, $offset = null, $ordered = array(), $selects = array(), $searchs = array(), $matching = array())
+ {
+ $qb = $this->createQueryBuilder('o');
+
+ if(count($selects) > 0){
+ $qb = $this->createSelect($qb, $selects);
+ }else{
+ $qb->select("DISTINCT o.createdAt, o.updatedAt, o.notes, o.numDisk, o.numPartition, o.size, o.usage, o.cacheContent, o.filesystem, o.partitionCode, o.osName, o.id");
+ }
+
+ if($term != ""){
+ if(count($searchs) > 0){
+ $qb = $this->createSearch($qb, $term, $searchs);
+ }else{
+ $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.numDisk LIKE :term OR o.numPartition LIKE :term OR o.size LIKE :term OR o.usage LIKE :term OR o.cacheContent LIKE :term OR o.filesystem LIKE :term OR o.partitionCode LIKE :term OR o.osName LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%');
+ }
+ }
+
+ $qb = $this->createMaching($qb, $matching);
+
+ $qb = $this->createOrdered($qb, $ordered);
+
+ if($limit != null){
+ $qb->setMaxResults($limit);
+ }
+
+ if($offset){
+ $qb->setFirstResult($offset);
+ }
+
+ $entities = $qb->getQuery()->getScalarResult();
+ return $entities;
+ }
+
+ public function countFiltered($term = "", $searchs = array(), $matching = array())
+ {
+ $qb = $this->createQueryBuilder('o');
+
+ $qb->select("count(DISTINCT o.id)");
+
+ if($term != ""){
+ if(count($searchs) > 0){
+ $qb = $this->createSearch($qb, $term, $searchs);
+ }else{
+ $qb->andWhere("o.createdAt LIKE :term OR o.updatedAt LIKE :term OR o.notes LIKE :term OR o.numDisk LIKE :term OR o.numPartition LIKE :term OR o.size LIKE :term OR o.usage LIKE :term OR o.cacheContent LIKE :term OR o.filesystem LIKE :term OR o.partitionCode LIKE :term OR o.osName LIKE :term OR o.id LIKE :term ")->setParameter('term', '%' . $term . '%');
+ }
+ }
+
+ $qb = $this->createMaching($qb, $matching);
+
+ $count = $qb->getQuery()->getSingleScalarResult();
+ return $count;
+ }
+}