refresh() public method

Refreshes the persistent state of a document from the database, overriding any local changes that have not yet been persisted.
public refresh ( object $document )
$document object The document to refresh.
Beispiel #1
0
 protected function initOrganization()
 {
     $repo = $this->getApplicationServiceLocator()->get('repositories')->get('Organizations/Organization');
     $name = 'Job Repository Test Organization';
     $results = $repo->findByName($name);
     $organization = $results[0];
     if (!$organization) {
         $organization = new Organization();
         $organization->setIsDraft(false);
         $organization->setOrganizationName(new OrganizationName());
         $organization->getOrganizationName()->setName($name);
         $this->dm->persist($organization);
         $this->dm->flush($organization);
         $this->dm->refresh($organization);
     }
     $this->organization = $organization;
 }
 /**
  * {@inheritdoc}
  */
 public function generateMissingForProduct(ProductInterface $product)
 {
     $this->generate($product);
     $this->documentManager->refresh($product);
 }