Add google token
Reflect updates on owning side
namespace Rapsys\AirBundle\Entity;
namespace Rapsys\AirBundle\Entity;
+use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Rapsys\UserBundle\Entity\User as BaseUser;
class User extends BaseUser {
/**
use Doctrine\Common\Collections\ArrayCollection;
use Rapsys\UserBundle\Entity\User as BaseUser;
class User extends BaseUser {
/**
+ private ?string $phone;
+ private ?Country $country;
+ private ?string $pseudonym;
+ private ?string $zipcode;
+ * @var \Doctrine\Common\Collections\Collection
+ private Collection $applications;
+ * @var \Doctrine\Common\Collections\Collection
+ private Collection $dances;
+ * @var \Doctrine\Common\Collections\Collection
+ private Collection $locations;
+ * @var \Doctrine\Common\Collections\Collection
+ private Collection $snippets;
+ * @var \Doctrine\Common\Collections\Collection
+ private Collection $subscribers;
+ * @var \Doctrine\Common\Collections\Collection
- private $subscriptions;
+ private Collection $subscriptions;
+
+ /**
+ * @var \Doctrine\Common\Collections\Collection
+ */
+ private Collection $googleTokens;
$this->snippets = new ArrayCollection();
$this->subscribers = new ArrayCollection();
$this->subscriptions = new ArrayCollection();
$this->snippets = new ArrayCollection();
$this->subscribers = new ArrayCollection();
$this->subscriptions = new ArrayCollection();
+ $this->googleTokens = new ArrayCollection();
- * @param Country $country
- public function setCountry(Country $country) {
- $this->country = $country;
+ public function setCity(?string $city): User {
+ $this->city = $city;
- public function getCountry() {
- return $this->country;
+ public function getCity(): ?string {
+ return $this->city;
+ * @param Country $country
- public function setCity(?string $city): User {
- $this->city = $city;
+ public function setCountry(?Country $country): User {
+ $this->country = $country;
- public function getCity(): ?string {
- return $this->city;
+ public function getCountry(): ?Country {
+ return $this->country;
- * @return ArrayCollection
+ * @return \Doctrine\Common\Collections\Collection
- public function getApplications(): ArrayCollection {
+ public function getApplications(): Collection {
return $this->applications;
}
return $this->applications;
}
- * @return ArrayCollection
+ * @return \Doctrine\Common\Collections\Collection
- public function getDances(): ArrayCollection {
+ public function getDances(): Collection {
- * @return ArrayCollection
+ * @return \Doctrine\Common\Collections\Collection
- public function getLocations(): ArrayCollection {
+ public function getLocations(): Collection {
return $this->locations;
}
return $this->locations;
}
- * @return ArrayCollection
+ * @return \Doctrine\Common\Collections\Collection
- public function getSnippets(): ArrayCollection {
+ public function getSnippets(): Collection {
return $this->snippets;
}
return $this->snippets;
}
- * @return ArrayCollection
+ * @return \Doctrine\Common\Collections\Collection
- public function getSubscribers(): ArrayCollection {
+ public function getSubscribers(): Collection {
return $this->subscribers;
}
return $this->subscribers;
}
* @return User
*/
public function addSubscription(User $subscription): User {
* @return User
*/
public function addSubscription(User $subscription): User {
+ //Add from owning side
+ $subscription->addSubscriber($this);
+
$this->subscriptions[] = $subscription;
return $this;
$this->subscriptions[] = $subscription;
return $this;
* @param User $subscription
*/
public function removeSubscription(User $subscription): bool {
* @param User $subscription
*/
public function removeSubscription(User $subscription): bool {
+ if (!$this->users->contains($user)) {
+ return true;
+ }
+
+ //Remove from owning side
+ $subscription->removeSubscriber($this);
+
return $this->subscriptions->removeElement($subscription);
}
/**
* Get subscriptions
*
return $this->subscriptions->removeElement($subscription);
}
/**
* Get subscriptions
*
- * @return ArrayCollection
+ * @return \Doctrine\Common\Collections\Collection
- public function getSubscriptions(): ArrayCollection {
+ public function getSubscriptions(): Collection {
return $this->subscriptions;
}
return $this->subscriptions;
}
+
+ /**
+ * Add google token
+ *
+ * @param GoogleToken $googleToken
+ *
+ * @return User
+ */
+ public function addGoogleToken(GoogleToken $googleToken): User {
+ $this->googleTokens[] = $googleToken;
+
+ return $this;
+ }
+
+ /**
+ * Remove google token
+ *
+ * @param GoogleToken $googleToken
+ */
+ public function removeGoogleToken(GoogleToken $googleToken): bool {
+ return $this->googleTokens->removeElement($googleToken);
+ }
+
+ /**
+ * Get googleTokens
+ *
+ * @return \Doctrine\Common\Collections\Collection
+ */
+ public function getGoogleTokens(): Collection {
+ return $this->googleTokens;
+ }