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

setName() public method

Sets the name for this unit.
public setName ( string $name )
$name string The name for this unit
    public function setName($name)
    {
        $this->name = $name;
    }

Usage 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::setName