WellCommerce\Bundle\DoctrineBundle\Manager\Manager::createResource PHP Method

createResource() public method

public createResource ( WellCommerce\Bundle\DoctrineBundle\Entity\EntityInterface $entity, boolean $flush = true )
$entity WellCommerce\Bundle\DoctrineBundle\Entity\EntityInterface
$flush boolean
    public function createResource(EntityInterface $entity, bool $flush = true)
    {
        $this->dispatchEvent(self::PRE_ENTITY_CREATE_EVENT, $entity);
        $this->getEntityManager()->persist($entity);
        $this->dispatchEvent(self::POST_ENTITY_CREATE_EVENT, $entity);
        if ($flush) {
            $this->getEntityManager()->flush();
        }
    }