34 if (!(
$row instanceof stdClass)) {
35 if (!is_numeric(
$row)) {
36 throw new InvalidArgumentException(
"Constructor accepts only a stdClass or null.");
43 throw new InvalidArgumentException(
"Relationship not found with ID $id");
60 parent::initializeAttributes();
62 $this->attributes[
'id'] = null;
63 $this->attributes[
'guid_one'] = null;
64 $this->attributes[
'relationship'] = null;
65 $this->attributes[
'guid_two'] = null;
100 if (array_key_exists(
$name, $this->attributes)) {
101 return $this->attributes[
$name];
132 throw new IOException(
"Unable to save new " . get_class());
143 public function delete() {
164 if (isset($CONFIG->relationship_url_handler[
$subtype])) {
165 $function = $CONFIG->relationship_url_handler[
$subtype];
167 if (isset($CONFIG->relationship_url_handler[
'all'])) {
168 $function = $CONFIG->relationship_url_handler[
'all'];
171 if (is_callable($function)) {
172 $url = call_user_func($function, $this);
181 $params = array(
'relationship' => $this);
193 $object->subject_guid = $this->guid_one;
194 $object->relationship = $this->relationship;
195 $object->object_guid = $this->guid_two;
197 $params = array(
'relationship' => $this);
234 $relationship->setAttribute(
'uuid', $uuid);
236 return $relationship;
256 $uuid_one =
$data->getAttribute(
'uuid1');
257 $uuid_two =
$data->getAttribute(
'uuid2');
262 if (($entity1) && ($entity2)) {
264 $this->attributes[
'guid_one'] = $entity1->getGUID();
265 $this->attributes[
'guid_two'] = $entity2->getGUID();
270 $relationship =
$data->getAttribute(
'type');
273 $this->attributes[
'relationship'] = $relationship;
277 throw new ImportException(
"There was a problem saving " . get_class());
318 return 'relationship';
328 return $this->relationship;
export()
Export this relationship.
getTimeCreated()
Returns the UNIX epoch time that this entity was created.
get_relationship($id)
Get a relationship by its ID.
add_entity_relationship($guid_one, $relationship, $guid_two)
Create a relationship between two entities.
get_uuid_from_object($object)
Get a UUID from a given object.
if($guid==elgg_get_logged_in_user_guid()) $name
getSystemLogID()
Return an identification for the object for storage in the system log.
get_entity_from_uuid($uuid)
This function attempts to retrieve a previously imported entity via its UUID.
__set($name, $value)
Set an attribute of the relationship.
__get($name)
Get an attribute of the relationship.
getType()
Return a type of the object - eg.
initializeAttributes()
(non-PHPdoc)
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
elgg global
Pointer to the global context.
delete_relationship($id)
Delete a relationship by its ID.
__construct($row=null)
Create a relationship object.
guid_to_uuid($guid)
Generate a UUID from a given GUID.
getObjectFromID($id)
For a given ID, return the object associated with it.
getExportableValues()
Return an array of fields which can be exported.
_elgg_get_relationship_row($id)
Get a database row from the relationship table.
save()
Save the relationship.
if(!$collection_name) $id
getURL()
Get a URL for this relationship.
getSubtype()
Return a subtype.