本文整理汇总了PHP中Aimeos\MShop\Customer\Manager\Factory::createManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::createManager方法的具体用法?PHP Factory::createManager怎么用?PHP Factory::createManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aimeos\MShop\Customer\Manager\Factory
的用法示例。
在下文中一共展示了Factory::createManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Sets up the fixture.
* This method is called before a test is executed.
*
* @access protected
*/
protected function setUp()
{
$this->editor = \TestHelper::getContext()->getEditor();
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Typo3');
$listManager = $manager->getSubManager('lists', 'Typo3');
$this->object = $listManager->getSubManager('type', 'Typo3');
}
示例2: testProcess
public function testProcess()
{
$type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY;
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
$addrManager = $manager->getSubManager('address');
$search = $manager->createSearch();
$search->setSlice(0, 1);
$result = $manager->searchItems($search);
if (($customerItem = reset($result)) === false) {
throw new \RuntimeException('No customer item found');
}
$addrItem = $customerItem->getPaymentAddress();
$addrItem->setId(null);
$basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$basketCntl->setAddress($type, $addrItem);
$view = \TestHelperHtml::getView();
$view->orderBasket = $basketCntl->get();
$view->orderBasket->setCustomerId($customerItem->getId());
$this->object->setView($view);
$this->object->process();
$orderAddress = $view->orderBasket->getAddress($type);
$actual = $addrManager->getItem($orderAddress->getAddressId());
$addrManager->deleteItem($actual->getId());
$this->assertEquals($addrItem->getFirstname(), $actual->getFirstname());
$this->assertEquals($addrItem->getLastname(), $actual->getLastname());
$this->assertEquals($addrItem->getPostal(), $actual->getPostal());
$this->assertEquals($addrItem->getTelephone(), $actual->getTelephone());
$this->assertEquals($addrItem->getTelefax(), $actual->getTelefax());
}
示例3: testProcess
public function testProcess()
{
$type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT;
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
$search = $manager->createSearch();
$search->setSlice(0, 1);
$result = $manager->searchItems($search);
if (($customerItem = reset($result)) === false) {
throw new \Exception('No customer item found');
}
$addrItem = $customerItem->getPaymentAddress();
$addrItem->setEmail('unittest@aimeos.org');
$mailStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\None')->disableOriginalConstructor()->getMock();
$mailMsgStub = $this->getMockBuilder('\\Aimeos\\MW\\Mail\\Message\\None')->disableOriginalConstructor()->disableOriginalClone()->getMock();
$mailStub->expects($this->once())->method('createMessage')->will($this->returnValue($mailMsgStub));
$mailStub->expects($this->once())->method('send');
$this->context->setMail($mailStub);
$basketCntl = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$basketCntl->setAddress($type, $addrItem);
$view = \TestHelperHtml::getView();
$view->orderBasket = $basketCntl->get();
$this->context->setView($view);
$this->object->setView($view);
$orderBaseStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
$customerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Customer\\Manager\\Standard')->setConstructorArgs(array($this->context))->setMethods(array('saveItem'))->getMock();
$orderBaseStub->expects($this->once())->method('saveItem');
$customerStub->expects($this->once())->method('saveItem');
\Aimeos\MShop\Factory::injectManager($this->context, 'customer', $customerStub);
\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $orderBaseStub);
$this->object->process();
}
示例4: migrate
/**
* Adds attribute test data.
*/
public function migrate()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if (!$this->additional instanceof $iface) {
throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
}
$this->msg('Adding Fos user bundle customer test data', 0);
$parentIds = array();
$ds = DIRECTORY_SEPARATOR;
$this->additional->setEditor('ai-fosuser:unittest');
$path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
if (($testdata = (include $path)) === false) {
throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
}
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'FosUser');
$customerAddressManager = $customerManager->getSubManager('address', 'FosUser');
$search = $customerManager->createSearch();
$search->setConditions($search->compare('==', 'customer.code', array('UTC001', 'UTC002', 'UTC003')));
$items = $customerManager->searchItems($search);
$this->conn->begin();
$customerManager->deleteItems(array_keys($items));
$parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem());
$this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
$this->conn->commit();
$this->status('done');
}
示例5: migrate
/**
* Inserts customer items.
*/
public function migrate()
{
$this->msg('Adding customer performance data', 0);
$context = $this->getContext();
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context);
$customerItem = $customerManager->createItem();
$customerItem->setCode('demo-test');
$customerItem->setLabel('Test demo unitperf user');
$customerItem->setPassword(sha1(microtime(true) . getmypid() . rand()));
$customerItem->setStatus(1);
$addrItem = $customerItem->getPaymentAddress();
$addrItem->setCompany('Test company');
$addrItem->setVatID('DE999999999');
$addrItem->setSalutation('mr');
$addrItem->setFirstname('Testdemo');
$addrItem->setLastname('Perfuser');
$addrItem->setAddress1('Test street');
$addrItem->setAddress2('1');
$addrItem->setPostal('1000');
$addrItem->setCity('Test city');
$addrItem->setLanguageId('en');
$addrItem->setCountryId('DE');
$addrItem->setEmail('me@localhost');
$customerManager->saveItem($customerItem);
$this->status('done');
}
示例6: setUpBeforeClass
public static function setUpBeforeClass()
{
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperHtml::getContext());
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
$result = $manager->searchItems($search);
if ((self::$customerItem = reset($result)) === false) {
throw new \Exception('No customer found');
}
}
示例7: getCustomerItem
/**
* @param string $code
*/
protected function getCustomerItem($code)
{
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'customer.code', $code));
$items = $manager->searchItems($search);
if (($item = reset($items)) === false) {
throw new \RuntimeException(sprintf('No customer item with code "%1$s" found', $code));
}
return $item;
}
示例8: getBasket
protected function getBasket()
{
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
$search = $customerManager->createSearch();
$search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
$result = $customerManager->searchItems($search);
if (($customer = reset($result)) === false) {
throw new \Exception('Customer item not found');
}
$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $customer->getPaymentAddress());
$controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $customer->getPaymentAddress());
return $controller->get();
}
示例9: getCustomerData
/**
* Gets required customer item ids.
*
* @param array $keys List with referenced Ids
* @return array $refIds List with referenced Ids
* @throws \Aimeos\MW\Setup\Exception If no type ID is found
*/
private function getCustomerData(array $keys)
{
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Standard');
$codes = array();
foreach ($keys as $dataset) {
if (($pos = strpos($dataset, '/')) === false || ($str = substr($dataset, $pos + 1)) === false) {
throw new \Aimeos\MW\Setup\Exception(sprintf('Some keys for ref customer are set wrong "%1$s"', $dataset));
}
$codes[] = $str;
}
$search = $customerManager->createSearch();
$search->setConditions($search->compare('==', 'customer.code', $codes));
$refIds = array();
foreach ($customerManager->searchItems($search) as $item) {
$refIds['customer/' . $item->getCode()] = $item->getId();
}
return $refIds;
}
示例10: process
/**
* Adds the customer data
*
* @param string $path Path to data file
* @throws \Aimeos\MShop\Exception
*/
protected function process($path)
{
if (($testdata = (include $path)) == false) {
throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
}
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Standard');
$customerAddressManager = $customerManager->getSubManager('address', 'Standard');
$customerGroupManager = $customerManager->getSubManager('group', 'Standard');
$search = $customerManager->createSearch();
$search->setConditions($search->compare('=~', 'customer.code', 'UTC00'));
$items = $customerManager->searchItems($search);
$this->conn->begin();
$customerManager->deleteItems(array_keys($items));
$parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem());
$this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
$this->addCustomerGroupData($testdata, $customerGroupManager);
$this->conn->commit();
}
示例11: setUpBeforeClass
public static function setUpBeforeClass()
{
$context = \TestHelper::getContext();
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context);
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
$result = $manager->searchItems($search);
if ((self::$customerItem = reset($result)) === false) {
throw new \Exception('No customer found');
}
$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($context);
$search = $manager->createSearch();
$search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE')));
foreach ($manager->searchItems($search, array('text', 'price', 'media')) as $id => $product) {
$prices = $product->getRefItems('price', 'default', 'default');
self::$productItems[$id]['price'] = reset($prices);
self::$productItems[$id]['item'] = $product;
}
}
示例12: migrate
/**
* Adds attribute test data.
*/
public function migrate()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if (!$this->additional instanceof $iface) {
throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
}
$this->msg('Adding Laravel customer test data', 0);
$this->additional->setEditor('ai-laravel:unittest');
$parentIds = array();
$ds = DIRECTORY_SEPARATOR;
$path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
if (($testdata = (include $path)) == false) {
throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
}
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Laravel');
$customerAddressManager = $customerManager->getSubManager('address', 'Laravel');
$this->cleanupCustomerData($customerManager, $customerAddressManager);
$this->conn->begin();
$parentIds = $this->addCustomerData($testdata, $customerManager, $customerAddressManager->createItem());
$this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
$this->conn->commit();
$this->status('done');
}
示例13: mysql
/**
* Adds attribute test data.
*/
protected function mysql()
{
$iface = '\\Aimeos\\MShop\\Context\\Item\\Iface';
if (!$this->additional instanceof $iface) {
throw new \Aimeos\MW\Setup\Exception(sprintf('Additionally provided object is not of type "%1$s"', $iface));
}
$this->msg('Adding TYPO3 customer test data', 0);
$this->additional->setEditor('ai-typo3:unittest');
$parentIds = array();
$ds = DIRECTORY_SEPARATOR;
$path = __DIR__ . $ds . 'data' . $ds . 'customer.php';
if (($testdata = (include $path)) == false) {
throw new \Aimeos\MShop\Exception(sprintf('No file "%1$s" found for customer domain', $path));
}
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->additional, 'Typo3');
$customerAddressManager = $customerManager->getSubManager('address', 'Typo3');
foreach ($customerManager->searchItems($customerManager->createSearch()) as $id => $item) {
$parentIds['customer/' . $item->getCode()] = $id;
}
$this->conn->begin();
$this->addCustomerAddressData($testdata, $customerAddressManager, $parentIds);
$this->conn->commit();
$this->status('done');
}
示例14: getBasket
protected function getBasket()
{
$controller = \Aimeos\Controller\Frontend\Basket\Factory::createController($this->context);
$customerManager = \Aimeos\MShop\Customer\Manager\Factory::createManager($this->context);
$customer = $customerManager->findItem('UTC001');
$controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $customer->getPaymentAddress());
$controller->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $customer->getPaymentAddress());
$productManager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
$product = $productManager->findItem('CNE');
$controller->addProduct($product->getId(), 2, array(), array(), array(), array(), array(), 'default');
$serviceManager = \Aimeos\MShop\Service\Manager\Factory::createManager($this->context);
$service = $serviceManager->findItem('unitpaymentcode', array(), 'service', 'payment');
$controller->setService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, $service->getId());
$service = $serviceManager->findItem('unitcode', array(), 'service', 'delivery');
$controller->setService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_DELIVERY, $service->getId());
return $controller->get();
}
示例15: getGroupItem
/**
* Returns the customer group item for the given code
*
* @param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object
* @param string $code Unique customer group code
* @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object
*/
protected function getGroupItem(\Aimeos\MShop\Context\Item\Iface $context, $code)
{
$manager = \Aimeos\MShop\Customer\Manager\Factory::createManager($context)->getSubmanager('group');
try {
$item = $manager->findItem($code);
} catch (\Aimeos\MShop\Exception $e) {
$item = $manager->createItem();
$item->setLabel($code);
$item->setCode($code);
$manager->saveItem($item);
}
return $item;
}