Aimeos\ShopBundle\Command\AccountCommand::createCustomerItem PHP Method

createCustomerItem() protected method

If the customer doesn't exist yet, it will be created.
protected createCustomerItem ( Aimeos\MShop\Context\Item\Iface $context, string $email, string $password ) : Aimeos\MShop\Customer\Item\Iface
$context Aimeos\MShop\Context\Item\Iface Aimeos context object
$email string Unique e-mail address
$password string New user password
return Aimeos\MShop\Customer\Item\Iface Aimeos customer item object
    protected function createCustomerItem(\Aimeos\MShop\Context\Item\Iface $context, $email, $password)
    {
        $manager = \Aimeos\MShop\Factory::createManager($context, 'customer');
        try {
            $item = $manager->findItem($email);
        } catch (\Aimeos\MShop\Exception $e) {
            $item = $manager->createItem();
        }
        $item->setCode($email);
        $item->setLabel($email);
        $item->getPaymentAddress()->setEmail($email);
        $item->setPassword($password);
        $item->setStatus(1);
        $manager->saveItem($item);
        return $item;
    }