Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace OAuthBundleEntity;
- use FOSOAuthServerBundleEntityClient as BaseClient;
- use DoctrineORMMapping as ORM;
- /**
- * @ORMEntity
- * @ORMTable("oauth_client")
- */
- class Client extends BaseClient
- {
- /**
- * @ORMId
- * @ORMColumn(type="integer")
- * @ORMGeneratedValue(strategy="AUTO")
- */
- protected $id;
- /**
- * @ORMColumn(type="string")
- */
- protected $name;
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * @param $name
- * @return Client
- */
- public function setName($name)
- {
- $this->name = $name;
- return $this;
- }
- /**
- * @param mixed $id
- */
- public function setId($id)
- {
- $this->id = $id;
- }
- /**
- * @return mixed
- */
- public function getId()
- {
- return $this->id;
- }
- }
- $client = new Client();
- $client->setId(4);
- $client->setRandomId('1wy8z9ayt6kgsw0s4cwk04ogs884cg08kkgg04gso4kckcscog');
- $client->setRedirectUris(array('http://dnsee.com'));
- $client->setSecret('59az3u43xn4so4g4wswscso4kookwsw00488oogw8kw4w4wgg0');
- $client->setAllowedGrantTypes(array('token', 'authorization_code','http://doing.com/grants/carsharing' ,'refresh_token'));
- $client->setName('CarsharingApp');
- $manager->persist($client);
- $manager->flush();
- DoctrineDBALExceptionNotNullConstraintViolationException: An exception occurred while executing 'INSERT INTO oauth_client (name) VALUES (?)' with params ["TestClient"]:
- SQLSTATE[HY000]: General error: 1364 Field 'random_id' doesn't have a default value
Add Comment
Please, Sign In to add comment