Skip to content

Commit 42ae0b2

Browse files
committed
Merge pull request #11 from K-Phoen/mongodb-support
Support Doctrine ODM as well as Doctrine ORM
2 parents f8c1209 + e72e152 commit 42ae0b2

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Uecode\Bundle\ApiKeyBundle\Document;
4+
5+
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
6+
use Uecode\Bundle\ApiKeyBundle\Model\ApiKeyUser as BaseUser;
7+
8+
class ApiKeyUser extends BaseUser
9+
{
10+
/**
11+
* @MongoDB\String
12+
*/
13+
protected $apiKey;
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Uecode\Bundle\ApiKeyBundle\Entity;
4+
5+
use Doctrine\ORM\Mapping as ORM;
6+
use Doctrine\ORM\Mapping\MappedSuperclass;
7+
use Uecode\Bundle\ApiKeyBundle\Model\ApiKeyUser as BaseUser;
8+
9+
/**
10+
* @MappedSuperclass
11+
*/
12+
class ApiKeyUser extends BaseUser
13+
{
14+
/**
15+
* @ORM\Column(name="api_key", type="string", length=255, nullable=true)
16+
*/
17+
protected $apiKey;
18+
}

src/Uecode/Bundle/ApiKeyBundle/Model/ApiKeyUser.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@
22

33
namespace Uecode\Bundle\ApiKeyBundle\Model;
44

5-
use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface;
6-
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
7-
use Symfony\Component\Validator\Constraints as Assert;
8-
use Doctrine\ORM\Mapping as ORM;
9-
use Doctrine\ORM\Mapping\MappedSuperclass;
105
use FOS\UserBundle\Model\User as BaseUser;
116
use FOS\UserBundle\Model\UserInterface;
7+
use Symfony\Component\Security\Core\User\UserInterface as BaseUserInterface;
8+
use Symfony\Component\Security\Core\User\AdvancedUserInterface;
129

13-
/**
14-
* @MappedSuperclass
15-
*/
1610
class ApiKeyUser extends BaseUser implements UserInterface, AdvancedUserInterface, BaseUserInterface
1711
{
18-
/**
19-
* @ORM\Column(name="api_key", type="string", length=255, nullable=true)
20-
*/
2112
protected $apiKey;
2213

2314
public function __construct()

0 commit comments

Comments
 (0)