Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Entities;
- /**
- * Network
- *
- * @Table(name="network")
- * @Entity
- */
- class Network
- {
- /**
- * @var integer $id
- *
- * @Column(name="id", type="integer", length=4)
- * @Id
- * @GeneratedValue(strategy="IDENTITY")
- */
- private $id;
- /**
- * @var string $name
- *
- * @Column(name="name", type="string", length=255)
- */
- private $name;
- /**
- * @var array $websites Required paramters to run on this network
- * @OneToMany(targetEntity="NetworkParams", mappedBy="network", cascade={"persist", "remove"}, fetch="LAZY")
- */
- private $network_params;
- public function __construct()
- {
- $this->network_params = new \Doctrine\Common\Collections\ArrayCollection();
- }
- /**
- * Get id
- *
- * @return integer $id
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * Get name
- *
- * @return string $name
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * Set name
- *
- * @param string $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
- /**
- * Set NetworkParams
- *
- * @param array $networkParams
- */
- public function setNetworkParams($networkParams)
- {
- $this->network_params = $networkParams;
- }
- /**
- * Add a network param to the network
- * @param \Entities\NetworkParam $networkParam
- */
- public function addNetworkParam($networkParam)
- {
- $this->network_params->add($networkParam);
- }
- /**
- *
- * @return Doctrine\Common\Collections\Collection $network_params;
- */
- public function getNetworkParams()
- {
- return $this->network_params;
- }
- }
- <?php
- namespace Entities;
- /**
- * Network
- *
- * @Table(name="network_params")
- * @Entity
- */
- class NetworkParams
- {
- /**
- * @var integer $id
- *
- * @Column(name="id", type="integer", length=4)
- * @Id
- * @GeneratedValue(strategy="IDENTITY")
- */
- private $id;
- /**
- * @var Entities\Network
- * @ManyToOne(targetEntity="Network", inversedBy="network_params", cascade={"persist", "remove"}, fetch="EAGER")
- */
- private $network;
- /**
- * @var string $name
- *
- * @Column(name="name", type="string", length=255)
- */
- private $name;
- /**
- * @var string $name
- *
- * @Column(name="type", type="smallint")
- */
- private $type;
- /**
- *
- * @var unknown_type
- * @Column(name="account_type", type="smallint")
- */
- private $account_type;
- /**
- * @return the $id
- */
- public function getId()
- {
- return $this->id;
- }
- /**
- * @return the $network
- */
- public function getNetwork()
- {
- return $this->network;
- }
- /**
- * @param Network $network
- */
- public function setNetwork($network)
- {
- $this->network = $network;
- }
- /**
- * @return the $name
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * @param string $name
- */
- public function setName($name)
- {
- $this->name = $name;
- }
- /**
- * @return the $type
- */
- public function getType()
- {
- return $this->type;
- }
- /**
- * @param string $type
- */
- public function setType($type)
- {
- $this->type = $type;
- }
- /**
- * @return the $account_type
- */
- public function getAccountType()
- {
- return $this->account_type;
- }
- /**
- * @param unknown_type $account_type
- */
- public function setAccountType($account_type)
- {
- $this->account_type = $account_type;
- }
- }
- $affiliateFuture = new Entities\Network();
- $affiliateFuture->setName('Affiliate Future');
- $username = new Entities\NetworkParams();
- $username->setName('username');
- $username->setAccountType(\Entities\Repositories\NetworkParamsRepository::ACCOUNT_TYPE_HYBRID);
- $username->setType(\Entities\Repositories\NetworkParamsRepository::TYPE_STRING);
- $affiliateFuture->addNetworkParam($username);
- $password = new Entities\NetworkParams();
- $password->setName('password');
- $password->setAccountType(\Entities\Repositories\NetworkParamsRepository::ACCOUNT_TYPE_HYBRID);
- $password->setType(\Entities\Repositories\NetworkParamsRepository::TYPE_STRING);
- $affiliateFuture->addNetworkParam($password);
- //$affiliateFuture->getNetworkParams()->add($password);
- $this->em->persist($affiliateFuture);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement