PartKeepr\SetupBundle\Services\FootprintSetupService::importFootprints PHP Method

importFootprints() public method

Imports the existing footprints. Skips existing footprints.
public importFootprints ( ) : array
return array An array with the keys "skipped" and "imported" which contain the number of footprints skipped and imported
    public function importFootprints()
    {
        $path = $this->kernel->locateResource(self::FOOTPRINT_PATH . self::FOOTPRINT_DATA);
        $skipped = 0;
        $count = 0;
        $yaml = new Parser();
        $data = $yaml->parse(file_get_contents($path));
        foreach ($data as $footprintName => $footprintData) {
            if ($this->footprintExists($footprintName)) {
                $skipped++;
                continue;
            }
            $this->createFootprint($footprintName, $footprintData);
            $count++;
        }
        $this->entityManager->flush();
        return ['skipped' => $skipped, 'imported' => $count];
    }