Skip to content

Commit

Permalink
Merge pull request #2 from bgallagher/master
Browse files Browse the repository at this point in the history
Seems to be working nicely now.
  • Loading branch information
pdobrigkeit committed Mar 1, 2013
2 parents 9d00baf + 23800dd commit e862e7e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function onBootstrap($e)
// Add the default entity driver only if specified in configuration
if ($options->getEnableDefaultEntities()) {
$chain = $sm->get('doctrine.driver.orm_default');
$chain->addDriver(new XmlDriver(__DIR__ . '/config/xml/zfcuserdoctrineorm'), 'ZfcUserDoctrineORM\Entity');
$chain->addDriver(new XmlDriver(__DIR__ . '/config/xml/goalioforgotpassworddoctrineorm'), 'GoalioForgotPasswordDoctrineORM\Entity');
}
}

Expand Down Expand Up @@ -44,7 +44,7 @@ public function getServiceConfig()
return new Options\ModuleOptions(isset($config['goalioforgotpassword']) ? $config['goalioforgotpassword'] : array());
},
'goalioforgotpassword_password_mapper' => function ($sm) {
return new \GoalioForgotPasswordDoctrineORM\Mapper\User(
return new \GoalioForgotPasswordDoctrineORM\Mapper\Password(
$sm->get('goalioforgotpassword_doctrine_em'),
$sm->get('goalioforgotpassword_module_options')
);
Expand Down
2 changes: 1 addition & 1 deletion config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

'orm_default' => array(
'drivers' => array(
'GoalioForgotPasswordDoctrineORM\Entity' => 'goalioforgotpassword_entity'
'GoalioForgotPassword\Entity' => 'goalioforgotpassword_entity'
)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<mapped-superclass name="GoalioForgotPassword\Entity\Password" table="user_password_reset">


<id name="request_key" type="string" length="32" />
<field name="userId" type="integer" column="user_id" unique="true" />
<id name="requestKey" type="string" length="32" column="request_key" />

<field name="user_id" type="integer" column="user_id" unique="true" />
<field name="requestTime" column="request_time" type="datetime" />

</mapped-superclass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<entity name="GoalioForgotPasswordDoctrineORM\Entity\Password" table="user_password_reset">

</entity>
Expand Down
6 changes: 3 additions & 3 deletions src/GoalioForgotPasswordDoctrineORM/Mapper/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public function findByUser($userId)
{
$er = $this->em->getRepository($this->options->getPasswordEntityClass());

return $er->findOneBy(array('user' => $userId));
return $er->findOneBy(array('user_id' => $userId));
}

public function findByUserIdRequestKey($userId, $key)
{
$er = $this->em->getRepository($this->options->getPasswordEntityClass());
return $er->findOneBy(array('user' => $userId, 'requestKey' => $key));
return $er->findOneBy(array('user_id' => $userId, 'requestKey' => $key));
}

public function cleanExpiredForgotRequests($expiryTime=86400)
Expand All @@ -51,7 +51,7 @@ public function cleanExpiredForgotRequests($expiryTime=86400)

public function cleanPriorForgotRequests($userId)
{
$dql = sprintf("DELETE %s u WHERE u.user = %s", $this->options->getPasswordEntityClass(), $userId);
$dql = sprintf("DELETE %s u WHERE u.user_id = %s", $this->options->getPasswordEntityClass(), $userId);
$query = $this->em->createQuery($dql);
$query->getResult();
}
Expand Down

0 comments on commit e862e7e

Please sign in to comment.