[FLOW3-general] Services

Adrian Grigore adrian at fjoor.com
Thu Apr 15 19:26:19 CEST 2010


Ok guys, another question. Assuming I have the following class:

/**
 * The registration service
 */
class RegistrationService {

/**
 * @var \F3\MyApplication\Domain\Repository\PersonRepository
 * @inject
 */
 protected $personRepository;

/**
 * @var \F3\FLOW3\Security\AccountFactory
 * @inject
 */
protected $accountFactory;

/**
 * @param \F3\MyApplication\Domain\Model\Model\Person $newPerson
 * @param string $password
 */
public function register(\F3\MyApplication\Domain\Model\Model\Person
$newPerson, $password) {
 $account =
$this->accountFactory->createAccountWithPassword($newPerson->getPrimaryElectronicAddress()->getIdentifier(),
$password);
 $newPerson->setAccount($account);
$this->personRepository->add($newPerson);
 }
}

How would I call the RegistrationService::register method in my controller
given the fact that $newPerson is not an instance
of F3\MyApplication\Domain\Model\Model\Person, but
of F3\MyApplication\Domain\Model\Model\Person_AOPProxy_Development.

-- 
Thanks,
Adrian


More information about the FLOW3-general mailing list