PartKeepr\SetupBundle\Services\ManufacturerSetupService::manufacturerExists PHP Méthode

manufacturerExists() protected méthode

Checks if the specified manufacturer exists.
protected manufacturerExists ( string $name ) : true
$name string The manufacturer name
Résultat true if the manufacturer exists, false otherwise
    protected function manufacturerExists($name)
    {
        $dql = "SELECT COUNT(m) FROM PartKeepr\\ManufacturerBundle\\Entity\\Manufacturer m WHERE m.name = :name";
        $query = $this->entityManager->createQuery($dql);
        $query->setParameter('name', $name);
        if ($query->getSingleScalarResult() == 0) {
            return false;
        } else {
            return true;
        }
    }