PartKeepr\PartBundle\Entity\PartMeasurementUnit::setShortName PHP Method

setShortName() public method

Short names are used for list views (e.g. if your unit name is "metres", your short name could be "m")
public setShortName ( string $shortName )
$shortName string The short name
    public function setShortName($shortName)
    {
        $this->shortName = $shortName;
    }

Usage Example

Example #1
0
 public function load(ObjectManager $manager)
 {
     $partUnit = new PartMeasurementUnit();
     $partUnit->setName("pieces");
     $partUnit->setShortName("pcs");
     $partUnit->setDefault(true);
     $part = new Part();
     $part->setName("FOOBAR");
     $part->setPartUnit($partUnit);
     $category = $this->getReference("partcategory.first");
     $storageLocation = $this->getReference("storagelocation.first");
     $part->setCategory($category);
     $part->setStorageLocation($storageLocation);
     $part2 = new Part();
     $part2->setName("FOOBAR2");
     $category = $this->getReference("partcategory.first");
     $storageLocation = $this->getReference("storagelocation.first");
     $part2->setCategory($category);
     $part2->setStorageLocation($storageLocation);
     $part2->setPartUnit($partUnit);
     $manager->persist($partUnit);
     $manager->persist($part);
     $manager->persist($part2);
     $manager->flush();
     $this->addReference("part.1", $part);
     $this->addReference("part.2", $part2);
 }
All Usage Examples Of PartKeepr\PartBundle\Entity\PartMeasurementUnit::setShortName