enable encounter name with quotes (#1715)
[openemr.git] / repositories / ProductRegistrationRepository.php
blobd050fcd5e0f60b4836d384af38aa2a1963617dfc
1 <?php
2 /**
3 * Product registration repository.
5 * Copyright (C) 2016 sherwin gaddis <sherwin@openmedpractice.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author sherwin gaddis <sherwin@openmedpractice.com>
20 * @link http://www.openmedpractice.com
23 namespace OpenEMR\Repositories;
25 use OpenEMR\Entities\ProductRegistration;
26 use Doctrine\ORM\EntityRepository;
28 class ProductRegistrationRepository extends EntityRepository
30 /**
31 * Finds the sole product registration entry in the database.
33 * @return product registration entry.
35 public function findFirst()
37 $results = $this->_em->getRepository($this->_entityName)->findAll();
38 if (!empty($results)) {
39 return $results[0];
42 return null;
45 /**
46 * Add product registration entry.
48 * @param $registration registration information.
49 * @return the id.
51 public function save(ProductRegistration $entry)
53 $this->_em->persist($entry);
54 $this->_em->flush();
55 return $entry->getRegistrationId();