예제 #1
0
파일: Job.php 프로젝트: EllynB/Incipio
 /**
  * @param Mandate|null $mandate
  *
  * @return $this
  */
 public function setMandate(Mandate $mandate = null)
 {
     // Handle bidirectional relationship
     // Check for the other side first
     if (null === $mandate && null !== $this->mandate && true === $this->mandate->getJobs()->contains($this)) {
         // Mandate was set and is being reset
         // Since it's a bidirectional relationship, unset the other relation from the other side first
         $this->mandate->removeJob($this);
     } elseif (null !== $mandate && false === $mandate->getJobs()->contains($this)) {
         $mandate->addJob($this);
     }
     $this->mandate = $mandate;
     return $this;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  *
  * @param Mandate $entity
  */
 public function remove($entity)
 {
     foreach ($entity->getJobs() as $job) {
         $job->setMandate(null);
     }
 }