<?php

namespace ApiBundle\Repository;

use ApiBundle\Entity\Device;
use Doctrine\ORM\EntityRepository;

/**
 * DeviceRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class DeviceRepository extends EntityRepository
{
    public function save(Device $entity)
    {
        $this->_em->persist($entity);
        $this->_em->flush();
    }

    public function update(Device $entity)
    {
        $this->_em->merge($entity);
        $this->_em->flush();
    }

    public function remove(Device $entity)
    {
        $this->_em->remove($entity);
        $this->_em->flush();
    }

    public function getAllAcceptedDevices()
    {
        return $this->findBy(['accepted' => 1]);
    }
}

{'avg_line_length': 19.358974358974358, 'max_line_length': 68, 'alphanum_fraction': 0.6185430463576159, 'licenses': ['MIT'], 'repository_name': 'MateuszBochen/TestArmy', 'path': 'src/ApiBundle/Repository/DeviceRepository.php', 'size': 755, 'lang': 'PHP'}