Processes the write queue.

@param AttachableInterface $instance
342878
public function afterSave(AttachableInterface $instance)
    {
        $this->instance = $instance;
        $this->save();

        $this->performCallableHookAfterProcessing();
    }
533074
public function process(MetadataInterface $metadata, $subject): void
    {
        $metadata->identifier = true;

        if ('auto' === $subject->strategy) {
            $metadata->documentMetadata->idGeneratorType = DocumentMetadata::GENERATOR_TYPE_AUTO;
        } else {
            $metadata->documentMetadata->idGeneratorType = DocumentMetadata::GENERATOR_TYPE_NONE;
        }
    }
1174450
private function processClass(\ArrayIterator $iterator, ResourceRecord $resourceRecord): void
    {
        if (Classes::isValid(strtoupper($iterator->current()))) {
            $resourceRecord->setClass(strtoupper($iterator->current()));
            $iterator->next();
        }
    }
961623
public function onWriteOnce($cb)
    {
        if (!$this->writing) {
            $cb($this);
            return;
        }
        $this->onWriteOnce->push($cb);
    }
734382
public function addSubscriber(SubscriberInterface $instance) {

		// make sure that an already registered object is removed before re-registering
		
		$this->removeSubscriber($instance);

		// register object hash

		$this->registeredHashes[] = spl_object_hash($instance);

		// parameters contain at least a method name; additionally a priority can be added
		
		foreach($instance::getEventsToSubscribe() as $eventName => $parameters) {

			$parameters	= (array) $parameters;
			$methodName	= array_shift($parameters); 

			if(count($parameters)) {
				$priority = (int) $parameters[0];
			}
			else {
				$priority = 0;
			}

			if(!isset($this->registry[$eventName]) || !isset($this->registry[$eventName][$priority])) {
				$this->registry[$eventName][$priority] = [];
			}

			$this->registry[$eventName][$priority][] = [$instance, $methodName];

			// force re-sort upon next dispatch

			unset ($this->sortedRegistry[$eventName]);

		}
		
	}
646895
public function attach(ObserverInterface $observer)
    {
        $observers = $this->getObservers();

        foreach ($observer->getEvents() as $event) {
            $observers[$event][] = $observer;
        }

        $this->setObservers($observers);
    }
158623
public function setSource(Processable $source)
    {
        if ($source instanceof PrintedVariableEngine) {
            parent::setSource($source);
        } else {
            $msg = "PrintedVariableProcessingException::setSource only accepts PrintedVariableEngine objects.";
            throw new InvalidArgumentException($msg);
        }
    }
999744
public function ensureSharding(?WriteConcern $writeConcern = null) : void
    {
        foreach ($this->metadataFactory->getAllMetadata() as $class) {
            assert($class instanceof ClassMetadata);
            if ($class->isMappedSuperclass || ! $class->isSharded()) {
                continue;
            }

            $this->ensureDocumentSharding($class->name, $writeConcern);
        }
    }
302534
public function write(WriterInterface $writer)
    {
        try {
            switch ($this->writeView($writer)) {
                case self::WRITE_OK:
                    $status = 'OK';
                    break;

                case self::WRITE_EXTERNAL:
                    $status = 'skipped, marked as external';
                    break;

                default:
                    $status = 'unsupported';
                    break;
            }
            $this->getDocument()->addLog(sprintf('* %s: %s', $this->getRawViewName(), $status));
        } catch (\Exception $e) {
            $this->getDocument()->addLog(sprintf('* %s: ERROR', $this->getRawViewName()));
            throw $e;
        }

        return $this;
    }
1052911
public function initialize($instance, ServiceLocatorInterface $serviceLocator)
    {
        if ($instance instanceof EventManagerAwareInterface)
            if ($instance->getEventManager() instanceof EventManagerInterface) {
                $instance->getEventManager()->setSharedManager(
                    $serviceLocator->get('SharedEventManager')
                );
            } else {
                $instance->setEventManager($serviceLocator->get('EventManager'));
            }

        if ($instance instanceof ServiceManagerAwareInterface)
            $instance->setServiceManager($serviceLocator);

        if ($instance instanceof ServiceLocatorAwareInterface)
            $instance->setServiceLocator($serviceLocator);
    }
864487
public function addMethod(PaymentInterface $instance)
    {
        if (null === $instance->getCode()) {
            throw new \RuntimeException(sprintf('Payment handler of class %s must return a code on getCode method. Please refer to the documentation (https://sonata-project.org/bundles/ecommerce/master/doc/reference/bundles/payment/index.html)', \get_class($instance)));
        }

        $this->methods[$instance->getCode()] = $instance;
    }
1025284
public function process() : void
    {
        if (isset($this->output)) {
            $this->output->call($this);
        } elseif (!$this->delegated) {
            self::$inout->error("Recipe is missing a call to `output` and did not delegate anything, not very useful probably...\n");
        }
    }
697844
public function initialize($instance, ServiceLocatorInterface $serviceLocator)
    {
        if ($instance instanceof ApplicationDbAware) {
            $instance->setApplicationDb($serviceLocator->get('prooph.link.app.db'));
        }
    }
1236071
public function store($instance, string $name = null): void
    {
        if ($name === null) {
            $name = get_class($instance);
        }

        $name = $this->getDefinitiveName($name);

        $this->instances[$name] = $instance;
    }
1030214
public function write(WriterInterface $writer)
    {
        foreach ($this->childs as $schema) {
            $schema->write($writer);
        }

        return $this;
    }
992387
public function write($content)
    {
        if ($this->isReadable()) {
            throw new \RuntimeException("Cannot write to a readable message");
        }

        $this->writable = true;
        $content = trim($content);
        fwrite($this->resource, $content . "\n");
    }
486712
def _attach_to_instance(self, instance):
        
        self._instance = instance
        self.lockable = self.lockable and instance.lockable