Guest User

Untitled

a guest
Oct 5th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. namespace OAuthBundleEntity;
  2.  
  3. use FOSOAuthServerBundleEntityClient as BaseClient;
  4. use DoctrineORMMapping as ORM;
  5.  
  6. /**
  7. * @ORMEntity
  8. * @ORMTable("oauth_client")
  9. */
  10. class Client extends BaseClient
  11. {
  12. /**
  13. * @ORMId
  14. * @ORMColumn(type="integer")
  15. * @ORMGeneratedValue(strategy="AUTO")
  16. */
  17. protected $id;
  18.  
  19. /**
  20. * @ORMColumn(type="string")
  21. */
  22. protected $name;
  23.  
  24. public function __construct()
  25. {
  26. parent::__construct();
  27. }
  28.  
  29. /**
  30. * @return string
  31. */
  32. public function getName()
  33. {
  34. return $this->name;
  35. }
  36.  
  37. /**
  38. * @param $name
  39. * @return Client
  40. */
  41. public function setName($name)
  42. {
  43. $this->name = $name;
  44. return $this;
  45. }
  46.  
  47. /**
  48. * @param mixed $id
  49. */
  50. public function setId($id)
  51. {
  52. $this->id = $id;
  53. }
  54.  
  55. /**
  56. * @return mixed
  57. */
  58. public function getId()
  59. {
  60. return $this->id;
  61. }
  62.  
  63. }
  64.  
  65. $client = new Client();
  66. $client->setId(4);
  67. $client->setRandomId('1wy8z9ayt6kgsw0s4cwk04ogs884cg08kkgg04gso4kckcscog');
  68. $client->setRedirectUris(array('http://dnsee.com'));
  69. $client->setSecret('59az3u43xn4so4g4wswscso4kookwsw00488oogw8kw4w4wgg0');
  70. $client->setAllowedGrantTypes(array('token', 'authorization_code','http://doing.com/grants/carsharing' ,'refresh_token'));
  71. $client->setName('CarsharingApp');
  72.  
  73. $manager->persist($client);
  74. $manager->flush();
  75.  
  76. DoctrineDBALExceptionNotNullConstraintViolationException: An exception occurred while executing 'INSERT INTO oauth_client (name) VALUES (?)' with params ["TestClient"]:
  77.  
  78. SQLSTATE[HY000]: General error: 1364 Field 'random_id' doesn't have a default value
Add Comment
Please, Sign In to add comment