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.95 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. public function __construct()
  39. {
  40. $this->network_params = new \Doctrine\Common\Collections\ArrayCollection();
  41. }
  42.  
  43.  
  44. /**
  45. * Get id
  46. *
  47. * @return integer $id
  48. */
  49. public function getId()
  50. {
  51. return $this->id;
  52. }
  53.  
  54. /**
  55. * Get name
  56. *
  57. * @return string $name
  58. */
  59. public function getName()
  60. {
  61. return $this->name;
  62. }
  63.  
  64. /**
  65. * Set name
  66. *
  67. * @param string $name
  68. */
  69. public function setName($name)
  70. {
  71. $this->name = $name;
  72. }
  73.  
  74. /**
  75. * Set NetworkParams
  76. *
  77. * @param array $networkParams
  78. */
  79. public function setNetworkParams($networkParams)
  80. {
  81. $this->network_params = $networkParams;
  82. }
  83.  
  84.  
  85. /**
  86. * Add a network param to the network
  87. * @param \Entities\NetworkParam $networkParam
  88. */
  89. public function addNetworkParam($networkParam)
  90. {
  91. $this->network_params->add($networkParam);
  92. }
  93.  
  94. /**
  95. *
  96. * @return Doctrine\Common\Collections\Collection $network_params;
  97. */
  98. public function getNetworkParams()
  99. {
  100. return $this->network_params;
  101. }
  102.  
  103. }
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. <?php
  112. namespace Entities;
  113.  
  114.  
  115. /**
  116. * Network
  117. *
  118. * @Table(name="network_params")
  119. * @Entity
  120. */
  121. class NetworkParams
  122. {
  123. /**
  124. * @var integer $id
  125. *
  126. * @Column(name="id", type="integer", length=4)
  127. * @Id
  128. * @GeneratedValue(strategy="IDENTITY")
  129. */
  130. private $id;
  131.  
  132. /**
  133. * @var Entities\Network
  134. * @ManyToOne(targetEntity="Network", inversedBy="network_params", cascade={"persist", "remove"}, fetch="EAGER")
  135. */
  136. private $network;
  137.  
  138. /**
  139. * @var string $name
  140. *
  141. * @Column(name="name", type="string", length=255)
  142. */
  143. private $name;
  144.  
  145. /**
  146. * @var string $name
  147. *
  148. * @Column(name="type", type="smallint")
  149. */
  150. private $type;
  151.  
  152. /**
  153. *
  154. * @var unknown_type
  155. * @Column(name="account_type", type="smallint")
  156. */
  157. private $account_type;
  158. /**
  159. * @return the $id
  160. */
  161. public function getId()
  162. {
  163. return $this->id;
  164. }
  165.  
  166. /**
  167. * @return the $network
  168. */
  169. public function getNetwork()
  170. {
  171. return $this->network;
  172. }
  173.  
  174. /**
  175. * @param Network $network
  176. */
  177. public function setNetwork($network)
  178. {
  179. $this->network = $network;
  180. }
  181.  
  182.  
  183. /**
  184. * @return the $name
  185. */
  186. public function getName()
  187. {
  188. return $this->name;
  189. }
  190.  
  191. /**
  192. * @param string $name
  193. */
  194. public function setName($name)
  195. {
  196. $this->name = $name;
  197. }
  198.  
  199. /**
  200. * @return the $type
  201. */
  202. public function getType()
  203. {
  204. return $this->type;
  205. }
  206.  
  207. /**
  208. * @param string $type
  209. */
  210. public function setType($type)
  211. {
  212. $this->type = $type;
  213. }
  214.  
  215. /**
  216. * @return the $account_type
  217. */
  218. public function getAccountType()
  219. {
  220. return $this->account_type;
  221. }
  222.  
  223. /**
  224. * @param unknown_type $account_type
  225. */
  226. public function setAccountType($account_type)
  227. {
  228. $this->account_type = $account_type;
  229. }
  230.  
  231. }
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238. $affiliateFuture = new Entities\Network();
  239. $affiliateFuture->setName('Affiliate Future');
  240.  
  241. $username = new Entities\NetworkParams();
  242. $username->setName('username');
  243. $username->setAccountType(\Entities\Repositories\NetworkParamsRepository::ACCOUNT_TYPE_HYBRID);
  244. $username->setType(\Entities\Repositories\NetworkParamsRepository::TYPE_STRING);
  245. $affiliateFuture->addNetworkParam($username);
  246.  
  247. $password = new Entities\NetworkParams();
  248. $password->setName('password');
  249. $password->setAccountType(\Entities\Repositories\NetworkParamsRepository::ACCOUNT_TYPE_HYBRID);
  250. $password->setType(\Entities\Repositories\NetworkParamsRepository::TYPE_STRING);
  251. $affiliateFuture->addNetworkParam($password);
  252. //$affiliateFuture->getNetworkParams()->add($password);
  253.  
  254. $this->em->persist($affiliateFuture);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement