本文整理匯總了PHP中Doctrine\ODM\MongoDB\Event\LifecycleEventArgs::getObjectManager方法的典型用法代碼示例。如果您正苦於以下問題:PHP LifecycleEventArgs::getObjectManager方法的具體用法?PHP LifecycleEventArgs::getObjectManager怎麽用?PHP LifecycleEventArgs::getObjectManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ODM\MongoDB\Event\LifecycleEventArgs
的用法示例。
在下文中一共展示了LifecycleEventArgs::getObjectManager方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function it_converts_metric_data_before_updating(LifecycleEventArgs $args, MetricInterface $metric, MeasureManager $manager, MeasureConverter $converter, DocumentManager $dm, ProductInterface $product, ProductValueInterface $productValue, UnitOfWork $uow, ClassMetadata $metadata)
{
$args->getObject()->willReturn($product);
$product->getValues()->willReturn([$productValue]);
$productValue->getData()->willReturn($metric);
$metric->getId()->willReturn(12);
$args->getObjectManager()->willReturn($dm);
$dm->getUnitOfWork()->willReturn($uow);
$uow->recomputeSingleDocumentChangeSet(Argument::type('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata'), $metric)->shouldBeCalled();
$metric->getUnit()->willReturn('cm');
$metric->getFamily()->willReturn('distance');
$metric->getData()->willReturn(100);
$manager->getStandardUnitForFamily('distance')->willReturn('m');
$converter->setFamily('distance')->shouldBeCalled()->willReturn($converter);
$converter->convertBaseToStandard('cm', 100)->willReturn(1);
$metric->setBaseData(1)->shouldBeCalled()->willReturn($metric);
$metric->setBaseUnit('m')->shouldBeCalled();
$dm->getClassMetadata(Argument::any())->willReturn($metadata);
$dm->getUnitOfWork()->willReturn($uow);
$uow->recomputeSingleDocumentChangeSet($metadata, $metric)->shouldBeCalled();
$this->preUpdate($args);
}