/** * Adds the given user to the blacklist of the current user. Blocked user will not be able to * add the current user to any channel anymore. * * @param GenericORMapperDataObject $User The user which should be blocked. * * @return Postbox Returns itself. */ public function addUserToBlacklist(GenericORMapperDataObject &$User) { if (!$this->hasUserOnBlacklist($User)) { $this->ORM->createAssociation('User2BlockedUser', $this->User, $User); } return $this; }
/** * Convenience method to create an association to another object without invoking the * GenericORMapper directly. * * @param string $relationName The relation to create. * @param GenericORMapperDataObject $targetObject The object to relate the current domain object to. * * @throws GenericORMapperException In case the data component is not initialized. * * @author Christian Achatz, Ralf Schubert * @version * Version 0.1, 30.10.2010<br /> */ public function createAssociation($relationName, GenericORMapperDataObject $targetObject) { // check weather data component is there if ($this->dataComponent === null) { throw new GenericORMapperException('[GenericDomainObject::createAssociation()] ' . 'The data component is not initialized, so related objects cannot be loaded! ' . 'Please use the or mapper\'s createAssociation() method or call ' . 'setDataComponent($orm), where $orm is an instance of the or mapper, on this ' . 'object first!', E_USER_ERROR); } // create association as desired $this->dataComponent->createAssociation($relationName, $this, $targetObject); }