/** * Declares an association between this object and a ChildUser object. * * @param ChildUser $v * @return $this|\keeko\core\model\Activity The current object (for fluent API support) * @throws PropelException */ public function setActor(ChildUser $v = null) { if ($v === null) { $this->setActorId(NULL); } else { $this->setActorId($v->getId()); } $this->aActor = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildUser object, it will not be re-added. if ($v !== null) { $v->addActivity($this); } return $this; }
/** * Interal mechanism to add Activities to User * * @param User $model * @param mixed $data */ protected function doAddActivities(User $model, $data) { $errors = []; foreach ($data as $entry) { if (!isset($entry['id'])) { $errors[] = 'Missing id for Activity'; } else { $related = ActivityQuery::create()->findOneById($entry['id']); $model->addActivity($related); } } if (count($errors) > 0) { return new ErrorsException($errors); } }