Advertisement
Guest User

Untitled

a guest
Oct 8th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.53 KB | None | 0 0
  1. <?php
  2. namespace Entities;
  3.  
  4.  
  5. /**
  6. * Network
  7. *
  8. * @Table(name="network")
  9. * @Entity
  10. */
  11. class Network
  12. {
  13. /**
  14. * @var integer $id
  15. *
  16. * @Column(name="id", type="integer", length=4)
  17. * @Id
  18. * @GeneratedValue(strategy="IDENTITY")
  19. */
  20. private $id;
  21.  
  22.  
  23. /**
  24. * @var string $name
  25. *
  26. * @Column(name="name", type="string", length=255)
  27. */
  28. private $name;
  29.  
  30.  
  31. /**
  32. * @var array $websites Required paramters to run on this network
  33. * @OneToMany(targetEntity="NetworkParams", mappedBy="network", cascade={"persist", "remove"}, fetch="LAZY")
  34. */
  35. private $network_params;
  36.  
  37.  
  38. /**
  39. * Get id
  40. *
  41. * @return integer $id
  42. */
  43. public function getId()
  44. {
  45. return $this->id;
  46. }
  47.  
  48. /**
  49. * Get name
  50. *
  51. * @return string $name
  52. */
  53. public function getName()
  54. {
  55. return $this->name;
  56. }
  57.  
  58. /**
  59. * Set name
  60. *
  61. * @param string $name
  62. */
  63. public function setName($name)
  64. {
  65. $this->name = $name;
  66. }
  67.  
  68. /**
  69. * Set NetworkParams
  70. *
  71. * @param array $networkParams
  72. */
  73. public function setNetworkParams($networkParams)
  74. {
  75. $this->network_params = $networkParams;
  76. }
  77.  
  78.  
  79. /**
  80. *
  81. * @return Doctrine\Common\Collections\Collection $network_params;
  82. */
  83. public function getNetworkParams()
  84. {
  85. return $this->network_params;
  86. }
  87.  
  88. }
  89.  
  90.  
  91.  
  92. <?php
  93. namespace Entities;
  94.  
  95.  
  96. /**
  97. * Network
  98. *
  99. * @Table(name="network_params")
  100. * @Entity
  101. */
  102. class NetworkParams
  103. {
  104. /**
  105. * @var integer $id
  106. *
  107. * @Column(name="id", type="integer", length=4)
  108. * @Id
  109. * @GeneratedValue(strategy="IDENTITY")
  110. */
  111. private $id;
  112.  
  113. /**
  114. * @var Entities\Network
  115. * @ManyToOne(targetEntity="Network", inversedBy="network_params", cascade={"persist", "remove"}, fetch="EAGER")
  116. */
  117. private $network;
  118.  
  119. /**
  120. * @var string $name
  121. *
  122. * @Column(name="name", type="string", length=255)
  123. */
  124. private $name;
  125.  
  126. /**
  127. * @var string $name
  128. *
  129. * @Column(name="type", type="smallint")
  130. */
  131. private $type;
  132.  
  133. /**
  134. *
  135. * @var unknown_type
  136. * @Column(name="account_type", type="smallint")
  137. */
  138. private $account_type;
  139. /**
  140. * @return the $id
  141. */
  142. public function getId()
  143. {
  144. return $this->id;
  145. }
  146.  
  147. /**
  148. * @return the $network
  149. */
  150. public function getNetwork()
  151. {
  152. return $this->network;
  153. }
  154.  
  155. /**
  156. * @param Network $network
  157. */
  158. public function setNetwork($network)
  159. {
  160. $this->network = $network;
  161. }
  162.  
  163.  
  164. /**
  165. * @return the $name
  166. */
  167. public function getName()
  168. {
  169. return $this->name;
  170. }
  171.  
  172. /**
  173. * @param string $name
  174. */
  175. public function setName($name)
  176. {
  177. $this->name = $name;
  178. }
  179.  
  180. /**
  181. * @return the $type
  182. */
  183. public function getType()
  184. {
  185. return $this->type;
  186. }
  187.  
  188. /**
  189. * @param string $type
  190. */
  191. public function setType($type)
  192. {
  193. $this->type = $type;
  194. }
  195.  
  196. /**
  197. * @return the $account_type
  198. */
  199. public function getAccountType()
  200. {
  201. return $this->account_type;
  202. }
  203.  
  204. /**
  205. * @param unknown_type $account_type
  206. */
  207. public function setAccountType($account_type)
  208. {
  209. $this->account_type = $account_type;
  210. }
  211.  
  212. }
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. $affiliateFuture = new Entities\Network();
  227. $affiliateFuture->setName('Affiliate Future');
  228.  
  229. $username = new Entities\NetworkParams();
  230. $username->setName('username');
  231. $username->setAccountType(\Entities\Repositories\NetworkParamsRepository::ACCOUNT_TYPE_HYBRID);
  232. $username->setType(\Entities\Repositories\NetworkParamsRepository::TYPE_STRING);
  233. $affiliateFuture->getNetworkParams()->add($username);
  234.  
  235. $password = new Entities\NetworkParams();
  236. $password->setName('password');
  237. $password->setAccountType(\Entities\Repositories\NetworkParamsRepository::ACCOUNT_TYPE_HYBRID);
  238. $password->setType(\Entities\Repositories\NetworkParamsRepository::TYPE_STRING);
  239. $affiliateFuture->getNetworkParams()->add($password);
  240.  
  241. $this->em->persist($affiliateFuture);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement