/** * Attach timeslot to this object * * @param Timeslot $timeslot * @return Timeslot */ function attachTimeslot(Timeslot $timeslot) { $object_id = $this->getObjectId(); if ($object_id == $timeslot->getObjectId()) { return true; } $timeslot->setObjectId($object_id); $timeslot->save(); return $timeslot; }
/** * Attach timeslot to this object * * @param Timeslot $timeslot * @return Timeslot */ function attachTimeslot(Timeslot $timeslot) { $manager_class = get_class($this->manager()); $object_id = $this->getObjectId(); if ($object_id == $timeslot->getObjectId() && $manager_class == $timeslot->getObjectManager()) { return true; } // if $timeslot->setObjectId($object_id); $timeslot->setObjectManager($manager_class); $timeslot->save(); return $timeslot; }