本文整理汇总了PHP中Aimeos\MShop\Service\Manager\Factory::createManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::createManager方法的具体用法?PHP Factory::createManager怎么用?PHP Factory::createManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aimeos\MShop\Service\Manager\Factory
的用法示例。
在下文中一共展示了Factory::createManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSaveDeleteItem
public function testSaveDeleteItem()
{
$manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelper::getContext());
$typeManager = $manager->getSubManager('type');
$search = $typeManager->createSearch();
$search->setConditions($search->compare('==', 'service.type.code', 'delivery'));
$result = $typeManager->searchItems($search);
if (($type = reset($result)) === false) {
throw new \Exception('No service type found');
}
$saveParams = (object) array('site' => 'unittest', 'items' => (object) array('service.position' => 1, 'service.label' => 'test service', 'service.status' => 1, 'service.code' => 'testcode', 'service.provider' => 'Standard', 'service.config' => array('default.url' => 'www.url.de', 'default.project' => 'test'), 'service.typeid' => $type->getId()));
$searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => array('==' => (object) array('service.code' => 'testcode')))));
$saved = $this->object->saveItems($saveParams);
$searched = $this->object->searchItems($searchParams);
$deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'service.id'});
$this->object->deleteItems($deleteParams);
$result = $this->object->searchItems($searchParams);
$this->assertInternalType('object', $saved['items']);
$this->assertNotNull($saved['items']->{'service.id'});
$this->assertEquals($saved['items']->{'service.id'}, $searched['items'][0]->{'service.id'});
$this->assertEquals($saved['items']->{'service.position'}, $searched['items'][0]->{'service.position'});
$this->assertEquals($saved['items']->{'service.label'}, $searched['items'][0]->{'service.label'});
$this->assertEquals($saved['items']->{'service.status'}, $searched['items'][0]->{'service.status'});
$this->assertEquals($saved['items']->{'service.code'}, $searched['items'][0]->{'service.code'});
$this->assertEquals($saved['items']->{'service.provider'}, $searched['items'][0]->{'service.provider'});
$this->assertEquals($saved['items']->{'service.config'}, $searched['items'][0]->{'service.config'});
$this->assertEquals($saved['items']->{'service.typeid'}, $searched['items'][0]->{'service.typeid'});
$this->assertEquals(1, count($searched['items']));
$this->assertEquals(0, count($result['items']));
}
示例2: testProcessOK
public function testProcessOK()
{
$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$baseManager = \Aimeos\MShop\Order\Manager\Factory::createManager($this->context)->getSubManager('base');
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$search = $serviceManager->createSearch();
$search->setConditions($search->compare('==', 'service.code', 'unitpaymentcode'));
$result = $serviceManager->searchItems($search);
if (($serviceItem = reset($result)) === false) {
throw new \Exception('No service item found');
}
$controller->setService('payment', $serviceItem->getId());
$controller->setAddress('payment', array('order.base.address.languageid' => 'en'));
$this->context->setUserId('-1');
$view = \TestHelper::getView();
$param = array('cs_order' => 1);
$helper = new \Aimeos\MW\View\Helper\Parameter\Standard($view, $param);
$view->addHelper('param', $helper);
$this->object->setView($view);
$this->object->process();
$search = $baseManager->createSearch();
$search->setConditions($search->compare('==', 'order.base.customerid', '-1'));
$result = $baseManager->searchItems($search);
if (($item = reset($result)) === false) {
throw new \Exception('No order placed');
}
$baseManager->deleteItem($item->getId());
$this->assertInstanceOf('\\Aimeos\\MShop\\Order\\Item\\Iface', $view->orderItem);
$this->assertEquals($item->getId(), $view->orderItem->getBaseId());
}
示例3: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$context = \TestHelper::getContext();
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($context);
$serviceItem = $serviceManager->createItem();
$this->object = new \Aimeos\MShop\Service\Provider\Delivery\Manual($context, $serviceItem);
}
示例4: testSaveDeleteItem
public function testSaveDeleteItem()
{
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperExtjs::getContext());
$search = $serviceManager->createSearch();
$search->setConditions($search->compare('==', 'service.label', 'unitlabel'));
$resultService = $serviceManager->searchItems($search);
if (($item = reset($resultService)) === false) {
throw new \Exception('No service item found');
}
$params = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('service.lists.type.domain' => 'product')))), 'start' => 0, 'limit' => 1);
$serviceListTypeManager = \Aimeos\Controller\ExtJS\Service\Lists\Type\Factory::createController(\TestHelperExtjs::getContext());
$resultType = $serviceListTypeManager->searchItems($params);
$saveParams = (object) array('site' => 'unittest', 'items' => (object) array('service.lists.parentid' => $item->getId(), 'service.lists.typeid' => $resultType['items'][0]->{'service.lists.type.id'}, 'service.lists.domain' => 'product', 'service.lists.refid' => -1, 'service.lists.datestart' => '2000-01-01 00:00:00', 'service.lists.dateend' => '2001-01-01 00:00:00', 'service.lists.config' => array('test' => 'unit'), 'service.lists.position' => 1, 'service.lists.status' => 1));
$searchParams = (object) array('site' => 'unittest', 'condition' => (object) array('&&' => array(0 => (object) array('==' => (object) array('service.lists.refid' => -1)))));
$saved = $this->object->saveItems($saveParams);
$searched = $this->object->searchItems($searchParams);
$deleteParams = (object) array('site' => 'unittest', 'items' => $saved['items']->{'service.lists.id'});
$this->object->deleteItems($deleteParams);
$result = $this->object->searchItems($searchParams);
$this->assertInternalType('object', $saved['items']);
$this->assertNotNull($saved['items']->{'service.lists.id'});
$this->assertEquals($saved['items']->{'service.lists.id'}, $searched['items'][0]->{'service.lists.id'});
$this->assertEquals($saved['items']->{'service.lists.parentid'}, $searched['items'][0]->{'service.lists.parentid'});
$this->assertEquals($saved['items']->{'service.lists.typeid'}, $searched['items'][0]->{'service.lists.typeid'});
$this->assertEquals($saved['items']->{'service.lists.domain'}, $searched['items'][0]->{'service.lists.domain'});
$this->assertEquals($saved['items']->{'service.lists.refid'}, $searched['items'][0]->{'service.lists.refid'});
$this->assertEquals($saved['items']->{'service.lists.datestart'}, $searched['items'][0]->{'service.lists.datestart'});
$this->assertEquals($saved['items']->{'service.lists.dateend'}, $searched['items'][0]->{'service.lists.dateend'});
$this->assertEquals($saved['items']->{'service.lists.config'}, $searched['items'][0]->{'service.lists.config'});
$this->assertEquals($saved['items']->{'service.lists.position'}, $searched['items'][0]->{'service.lists.position'});
$this->assertEquals($saved['items']->{'service.lists.status'}, $searched['items'][0]->{'service.lists.status'});
$this->assertEquals(1, count($searched['items']));
$this->assertEquals(0, count($result['items']));
}
示例5: addServiceData
/**
* Adds the service test data.
*
* @param array $testdata Associative list of key/list pairs
* @throws \Aimeos\MW\Setup\Exception If a required ID is not available
*/
private function addServiceData(array $testdata)
{
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->additional, 'Standard');
$serviceTypeManager = $serviceManager->getSubManager('type', 'Standard');
$typeIds = array();
$type = $serviceTypeManager->createItem();
$this->conn->begin();
foreach ($testdata['service/type'] as $key => $dataset) {
$type->setId(null);
$type->setCode($dataset['code']);
$type->setDomain($dataset['domain']);
$type->setLabel($dataset['label']);
$type->setStatus($dataset['status']);
$serviceTypeManager->saveItem($type);
$typeIds[$key] = $type->getId();
}
$parent = $serviceManager->createItem();
foreach ($testdata['service'] as $key => $dataset) {
if (!isset($typeIds[$dataset['typeid']])) {
throw new \Aimeos\MW\Setup\Exception(sprintf('No service type ID found for "%1$s"', $dataset['typeid']));
}
$parent->setId(null);
$parent->setTypeId($typeIds[$dataset['typeid']]);
$parent->setPosition($dataset['pos']);
$parent->setCode($dataset['code']);
$parent->setLabel($dataset['label']);
$parent->setProvider($dataset['provider']);
$parent->setConfig($dataset['config']);
$parent->setStatus($dataset['status']);
$serviceManager->saveItem($parent, false);
}
$this->conn->commit();
}
示例6: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->editor = \TestHelperMShop::getContext()->getEditor();
$manager = \Aimeos\MShop\Service\Manager\Factory::createManager(\TestHelperMShop::getContext());
$listManager = $manager->getSubManager('lists');
$this->object = $listManager->getSubManager('type');
}
示例7: run
/**
* Executes the job.
*
* @throws \Aimeos\Controller\Jobs\Exception If an error occurs
*/
public function run()
{
$context = $this->getContext();
/** controller/jobs/order/service/delivery/limit-days
* Only start the delivery process of orders that were created in the past within the configured number of days
*
* The delivery process is normally started immediately after the
* notification about a successful payment arrived. This option prevents
* orders from being shipped in case anything went wrong or an update
* failed and old orders would have been shipped now.
*
* @param integer Number of days
* @since 2014.03
* @category User
* @category Developer
* @see controller/jobs/order/email/payment/standard/limit-days
* @see controller/jobs/order/email/delivery/standard/limit-days
*/
$days = $context->getConfig()->get('controller/jobs/order/service/delivery/limit-days', 90);
$date = date('Y-m-d 00:00:00', time() - 86400 * $days);
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($context);
$serviceSearch = $serviceManager->createSearch();
$serviceSearch->setConditions($serviceSearch->compare('==', 'service.type.code', 'delivery'));
$orderManager = \Aimeos\MShop\Order\Manager\Factory::createManager($context);
$orderSearch = $orderManager->createSearch();
$start = 0;
do {
$serviceItems = $serviceManager->searchItems($serviceSearch);
foreach ($serviceItems as $serviceItem) {
try {
$serviceProvider = $serviceManager->getProvider($serviceItem);
$expr = array($orderSearch->compare('==', 'order.siteid', $serviceItem->getSiteId()), $orderSearch->compare('>', 'order.datepayment', $date), $orderSearch->compare('>', 'order.statuspayment', \Aimeos\MShop\Order\Item\Base::PAY_PENDING), $orderSearch->compare('==', 'order.statusdelivery', \Aimeos\MShop\Order\Item\Base::STAT_UNFINISHED), $orderSearch->compare('==', 'order.base.service.code', $serviceItem->getCode()), $orderSearch->compare('==', 'order.base.service.type', 'delivery'));
$orderSearch->setConditions($orderSearch->combine('&&', $expr));
$orderStart = 0;
do {
$orderItems = $orderManager->searchItems($orderSearch);
foreach ($orderItems as $orderItem) {
try {
$serviceProvider->process($orderItem);
$orderManager->saveItem($orderItem);
} catch (\Exception $e) {
$str = 'Error while processing order with ID "%1$s": %2$s';
$context->getLogger()->log(sprintf($str, $orderItem->getId(), $e->getMessage()));
}
}
$orderCount = count($orderItems);
$orderStart += $orderCount;
$orderSearch->setSlice($orderStart);
} while ($orderCount >= $orderSearch->getSliceSize());
} catch (\Exception $e) {
$str = 'Error while processing service with ID "%1$s": %2$s';
$context->getLogger()->log(sprintf($str, $serviceItem->getId(), $e->getMessage()));
}
}
$count = count($serviceItems);
$start += $count;
$serviceSearch->setSlice($start);
} while ($count >= $serviceSearch->getSliceSize());
}
示例8: setUp
protected function setUp()
{
$this->context = \TestHelperMShop::getContext();
$servManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$this->servItem = $servManager->createItem();
$this->mockProvider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Decorator\\Example')->disableOriginalConstructor()->getMock();
$this->object = new \Aimeos\MShop\Service\Provider\Decorator\Weight($this->mockProvider, $this->context, $this->servItem);
}
示例9: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$context = \TestHelperMShop::getContext();
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($context);
$serviceItem = $serviceManager->createItem();
$serviceItem->setCode('test');
$this->object = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Payment\\PostPay')->setMethods(array('getOrder', 'getOrderBase', 'saveOrder', 'saveOrderBase'))->setConstructorArgs(array($context, $serviceItem))->getMock();
}
示例10: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$context = \TestHelper::getContext();
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($context);
$item = $serviceManager->createItem();
$item->setConfig(array('authorizenet.testmode' => true));
$this->object = new AuthorizeAIMPublic($context, $item);
}
示例11: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->context = \TestHelper::getContext();
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$item = $serviceManager->createItem();
$item->setConfig(array('sagepay.testmode' => true));
$this->object = $this->getMockBuilder('Aimeos\\MShop\\Service\\Provider\\Payment\\SagePayPublic')->setMethods(array('getOrder', 'getOrderBase', 'saveOrder', 'saveOrderBase', 'getProvider'))->setConstructorArgs(array($this->context, $item))->getMock();
}
示例12: setUp
protected function setUp()
{
$this->context = \TestHelperMShop::getContext();
$this->context->setUserId(null);
$servManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$this->servItem = $servManager->createItem();
$this->mockProvider = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Decorator\\OrderCheck')->disableOriginalConstructor()->getMock();
$this->basket = \Aimeos\MShop\Order\Manager\Factory::createManager($this->context)->getSubManager('base')->createItem();
$this->object = new \Aimeos\MShop\Service\Provider\Decorator\OrderCheck($this->mockProvider, $this->context, $this->servItem);
}
示例13: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (!class_exists('Omnipay\\Omnipay')) {
$this->markTestSkipped('Omnipay library not available');
}
$this->context = \TestHelper::getContext();
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$item = $serviceManager->createItem();
$item->setConfig(array('authorizenet.testmode' => true));
$this->object = $this->getMockBuilder('Aimeos\\MShop\\Service\\Provider\\Payment\\AuthorizeSIMPublic')->setMethods(array('getOrder', 'getOrderBase', 'saveOrder', 'saveOrderBase', 'getProvider'))->setConstructorArgs(array($this->context, $item))->getMock();
}
示例14: setUp
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
if (!class_exists('Omnipay\\Omnipay')) {
$this->markTestSkipped('Omnipay library not available');
}
$this->context = \TestHelper::getContext();
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$this->serviceItem = $serviceManager->createItem();
$this->serviceItem->setConfig(array('omnipay.type' => 'Dummy'));
$this->object = $this->getMockBuilder('\\Aimeos\\MShop\\Service\\Provider\\Payment\\OmniPay')->setMethods(array('getOrder', 'getOrderBase', 'saveOrder', 'saveOrderBase', 'getProvider', 'saveTransationRef'))->setConstructorArgs(array($this->context, $this->serviceItem))->getMock();
}
示例15: setUp
protected function setUp()
{
$this->context = \TestHelper::getContext();
$servManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$search = $servManager->createSearch();
$search->setConditions($search->compare('==', 'service.provider', 'Standard'));
$result = $servManager->searchItems($search, array('price'));
if (($item = reset($result)) === false) {
throw new \Exception('No order base item found');
}
$this->object = new TestBase($this->context, $item);
}