/** * Removes the specified validator. * * @param Tx_Extbase_Validation_ValidatorInterface $validator The validator to remove */ public function removeValidator(Tx_Extbase_Validation_Validator_ValidatorInterface $validator) { if (!$this->validators->contains($validator)) { throw new Tx_Extbase_Validation_Exception_NoSuchValidator('Cannot remove validator because its not in the conjunction.', 1207020177); } $this->validators->detach($validator); }
/** * Replaces an object by another. * * @param object $existingObject The existing object * @param object $newObject The new object * @return void * @api */ public function replace($existingObject, $newObject) { if (!$existingObject instanceof $this->objectType) { throw new Tx_Extbase_Persistence_Exception_IllegalObjectType('The existing object given to replace was not of the type (' . $this->objectType . ') this repository manages.', 1248363434); } if (!$newObject instanceof $this->objectType) { throw new Tx_Extbase_Persistence_Exception_IllegalObjectType('The new object given to replace was not of the type (' . $this->objectType . ') this repository manages.', 1248363439); } $backend = $this->persistenceManager->getBackend(); $session = $this->persistenceManager->getSession(); $uuid = $backend->getIdentifierByObject($existingObject); if ($uuid !== NULL) { $backend->replaceObject($existingObject, $newObject); $session->unregisterReconstitutedObject($existingObject); $session->registerReconstitutedObject($newObject); if ($this->removedObjects->contains($existingObject)) { $this->removedObjects->detach($existingObject); $this->removedObjects->attach($newObject); } } elseif ($this->addedObjects->contains($existingObject)) { $this->addedObjects->detach($existingObject); $this->addedObjects->attach($newObject); } else { throw new Tx_Extbase_Persistence_Exception_UnknownObject('The "existing object" is unknown to the persistence backend.', 1238068475); } }
/** * Call the view helper associated with this object. * * First, it evaluates the arguments of the view helper. * * If the view helper implements Tx_Fluid_Core_ViewHelper_Facets_ChildNodeAccessInterface, * it calls setChildNodes(array childNodes) on the view helper. * * Afterwards, checks that the view helper did not leave a variable lying around. * * @param Tx_Fluid_Core_Rendering_RenderingContextInterface $renderingContext * @return object evaluated node after the view helper has been called. * @author Sebastian Kurfürst <*****@*****.**> * @author Karsten Dambekalns <*****@*****.**> * @todo check recreation of viewhelper when revisiting caching */ public function evaluate(Tx_Fluid_Core_Rendering_RenderingContextInterface $renderingContext) { $objectManager = $renderingContext->getObjectManager(); $contextVariables = $renderingContext->getTemplateVariableContainer()->getAllIdentifiers(); if ($this->viewHelpersByContext->contains($renderingContext)) { $viewHelper = $this->viewHelpersByContext[$renderingContext]; } else { $viewHelper = clone $this->uninitializedViewHelper; $this->viewHelpersByContext->attach($renderingContext, $viewHelper); } $evaluatedArguments = array(); $renderMethodParameters = array(); if (count($viewHelper->prepareArguments())) { foreach ($viewHelper->prepareArguments() as $argumentName => $argumentDefinition) { if (isset($this->arguments[$argumentName])) { $argumentValue = $this->arguments[$argumentName]; $evaluatedArguments[$argumentName] = $this->convertArgumentValue($argumentValue, $argumentDefinition->getType(), $renderingContext); } else { $evaluatedArguments[$argumentName] = $argumentDefinition->getDefaultValue(); } if ($argumentDefinition->isMethodParameter()) { $renderMethodParameters[$argumentName] = $evaluatedArguments[$argumentName]; } } } $viewHelperArguments = $objectManager->create('Tx_Fluid_Core_ViewHelper_Arguments', $evaluatedArguments); $viewHelper->setArguments($viewHelperArguments); $viewHelper->setTemplateVariableContainer($renderingContext->getTemplateVariableContainer()); if ($renderingContext->getControllerContext() !== NULL) { $viewHelper->setControllerContext($renderingContext->getControllerContext()); } $viewHelper->setViewHelperVariableContainer($renderingContext->getViewHelperVariableContainer()); $viewHelper->setViewHelperNode($this); $viewHelper->setRenderingContext($renderingContext); if ($viewHelper instanceof Tx_Fluid_Core_ViewHelper_Facets_ChildNodeAccessInterface) { $viewHelper->setChildNodes($this->childNodes); } $output = $viewHelper->initializeArgumentsAndRender($renderMethodParameters); return $output; }
/** * Checks whether the given object is known to the identity map * * @param object $object * @return boolean * @author Karsten Dambekalns <*****@*****.**> */ public function hasObject($object) { return $this->objectMap->contains($object); }
/** * @see Tx_Extbase_Persistence_ObjectStorage::contains */ public function contains($object) { $this->initialize(); return parent::contains($object); }