Skip to content
This repository has been archived by the owner on Mar 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #26 from basz/fix/orm-constraints
Browse files Browse the repository at this point in the history
adds cascade options on relations, so users can safely be deleted
  • Loading branch information
TomHAnderson committed May 18, 2015
2 parents a84af5e + c036a72 commit 8deebf1
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 154 deletions.
28 changes: 28 additions & 0 deletions config/oauth2.doctrine-orm.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,46 @@ return array(
'client_entity' => array(
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'field' => 'client',
'additional_mapping_data' => array(
'joinColumns' => array(
array(
'onDelete' => 'CASCADE'
),
),
),
),
'access_token_entity' => array(
'entity' => 'ZF\OAuth2\Doctrine\Entity\AccessToken',
'field' => 'accessToken',
'additional_mapping_data' => array(
'joinColumns' => array(
array(
'onDelete' => 'CASCADE'
),
),
),
),
'authorization_code_entity' => array(
'entity' => 'ZF\OAuth2\Doctrine\Entity\AuthorizationCode',
'field' => 'authorizationCode',
'additional_mapping_data' => array(
'joinColumns' => array(
array(
'onDelete' => 'CASCADE'
),
),
),
),
'refresh_token_entity' => array(
'entity' => 'ZF\OAuth2\Doctrine\Entity\RefreshToken',
'field' => 'refreshToken',
'additional_mapping_data' => array(
'joinColumns' => array(
array(
'onDelete' => 'CASCADE'
),
),
),
),
),
'mapping' => array(
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.AccessToken.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<field name="expires" type="datetime" nullable="true"/>
<many-to-one field="client" target-entity="ZF\OAuth2\Doctrine\Entity\Client" inversed-by="accessToken">
<join-columns>
<join-column name="client_id" referenced-column-name="id" nullable="false"/>
<join-column name="client_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
<many-to-many field="scope" target-entity="ZF\OAuth2\Doctrine\Entity\Scope" mapped-by="accessToken"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<field name="idToken" type="text" nullable="true"/>
<many-to-one field="client" target-entity="ZF\OAuth2\Doctrine\Entity\Client" inversed-by="authorizationCode">
<join-columns>
<join-column name="client_id" referenced-column-name="id" nullable="false"/>
<join-column name="client_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
<many-to-many field="scope" target-entity="ZF\OAuth2\Doctrine\Entity\Scope" mapped-by="authorizationCode"/>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.Jti.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<field name="jti" type="text" nullable="true"/>
<many-to-one field="client" target-entity="ZF\OAuth2\Doctrine\Entity\Client" inversed-by="jti">
<join-columns>
<join-column name="client_id" referenced-column-name="id" nullable="false"/>
<join-column name="client_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
</entity>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.Jwt.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<field name="publicKey" type="text" nullable="true"/>
<many-to-one field="client" target-entity="ZF\OAuth2\Doctrine\Entity\Client" inversed-by="jwt">
<join-columns>
<join-column name="client_id" referenced-column-name="id" nullable="false"/>
<join-column name="client_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
</entity>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.PublicKey.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<field name="encryptionAlgorithm" type="string" nullable="true"/>
<many-to-one field="client" target-entity="ZF\OAuth2\Doctrine\Entity\Client" inversed-by="publicKey">
<join-columns>
<join-column name="client_id" referenced-column-name="id" nullable="false"/>
<join-column name="client_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
</entity>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.RefreshToken.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<field name="expires" type="datetime" nullable="true"/>
<many-to-one field="client" target-entity="ZF\OAuth2\Doctrine\Entity\Client" inversed-by="refreshToken">
<join-columns>
<join-column name="client_id" referenced-column-name="id" nullable="false"/>
<join-column name="client_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
<many-to-many field="scope" target-entity="ZF\OAuth2\Doctrine\Entity\Scope" mapped-by="refreshToken"/>
Expand Down
Loading

0 comments on commit 8deebf1

Please sign in to comment.