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

setDefault() public method

Defines if the unit is default or not.
public setDefault ( boolean $default )
$default boolean True if the unit is default, false otherwise
    public function setDefault($default)
    {
        $this->default = (bool) $default;
    }

Usage Example

Exemplo n.º 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::setDefault