modules/Campaigns/ProspectLink.php

Show: inherited
Table of Contents

\ProspectLink

Package: SugarCRM

Represents a relationship from a single beans perspective.

Parent(s)
\Link2
Brief
Bug #40166. Campaign Log Report will not display Contact/Account Names  

Properties

Propertyprotected  $beans= ''
inheritedInherited from: \Link2::$$beans
Details
Type
n/a
Inherited_from
\Link2::$$beans  
Propertyprotected  $def= ''
inheritedInherited from: \Link2::$$def
Details
Type
n/a
Inherited_from
\Link2::$$def  
Propertyprotected  $focus= ''
inheritedInherited from: \Link2::$$focus
Details
Type
n/a
Inherited_from
\Link2::$$focus  
Propertyprotected  $loaded= ''
inheritedInherited from: \Link2::$$loaded
Details
Type
n/a
Inherited_from
\Link2::$$loaded  
Propertyprotected  $name= ''
inheritedInherited from: \Link2::$$name
Details
Type
n/a
Inherited_from
\Link2::$$name  
Propertyprotected  $relationship= ''
inheritedInherited from: \Link2::$$relationship
Details
Type
n/a
Inherited_from
\Link2::$$relationship  
Propertyprotected  $relationship_fields= 'array()'
inheritedInherited from: \Link2::$$relationship_fields
Default valuearray()Details
Type
n/a
Inherited_from
\Link2::$$relationship_fields  
Propertyprotected  $rows= ''
inheritedInherited from: \Link2::$$rows
Details
Type
n/a
Inherited_from
\Link2::$$rows  
Propertyprotected  $tempBeans= 'array()'
inheritedInherited from: \Link2::$$tempBeans
Default valuearray()Details
Type
n/a
Inherited_from
\Link2::$$tempBeans  

Methods

methodpublic__construct( \$linkName $linkName, \$bean $bean, \$linkDef $linkDef = false ) : void
inherited

Inherited from: \Link2::__construct()
Parameters
Name Type Description
$linkName \$linkName

String name of a link field in the module's vardefs

$bean \$bean

SugarBean focus bean for this link (one half of a relationship)

$linkDef \$linkDef

Array Optional vardef for the link in case it can't be found in the passed in bean for the global dictionary

methodpublic__get(  $name ) : void
inherited

Inherited from: \Link2::__get()
Parameters
Name Type Description
$name
methodpublic__set(  $name,  $val ) : void
inherited

Inherited from: \Link2::__set()
Parameters
Name Type Description
$name
$val
methodpublic_get_alternate_key_fields(  $table_name ) : void
inherited

Inherited from: \Link2::_get_alternate_key_fields()
Parameters
Name Type Description
$table_name
methodpublic_get_bean_position( ) : boolean
inherited

Inherited from: \Link2::_get_bean_position()
Returns
Type Description
boolean returns true if this link is LHS
methodpublic_get_link_table_definition(  $table_name,  $def_name ) : void
inherited

Inherited from: \Link2::_get_link_table_definition()
Parameters
Name Type Description
$table_name
$def_name
methodpublic_get_link_table_role_field( \$table_name $table_name ) : bool | string
inherited

Inherited from: \Link2::_get_link_table_role_field()
Parameters
Name Type Description
$table_name \$table_name

name of relationship table to inspect

Returns
Type Description
bool | string
methodpublicadd( array $rel_keys, array $additional_values = array() ) : boolean | array
inherited

use this function to create link between 2 objects 1:1 will be treated like 1 to many.

Inherited from: \Link2::add()

the function also allows for setting of values for additional field in the table being updated to save the relationship, in case of many-to-many relationships this would be the join table.

Parameters
Name Type Description
$rel_keys array

array of ids or SugarBean objects. If you have the bean in memory, pass it in.

$additional_values array

the values should be passed as key value pairs with column name as the key name and column value as key value.

Returns
Type Description
boolean | array Return true if all relationships were added. Return an array with the failed keys if any of them failed.
methodpublicaddBean( \SugarBean $bean ) : void
inherited

Add a bean object to the list of beans currently loaded to this relationship.

Inherited from: \Link2::addBean()

This for the most part should not need to be called except by the relatipnship implementation classes.

Parameters
Name Type Description
$bean \SugarBean
methodpublicbeansAreLoaded( ) : bool
inherited

Inherited from: \Link2::beansAreLoaded()
Returns
Type Description
bool true if this link has initialized its related beans.
methodpublicdelete( \$id $id, string $related_id = '' ) : boolean
inherited

Marks the relationship delted for this given record pair.

Inherited from: \Link2::delete()
Parameters
Name Type Description
$id \$id

id of the Parent/Focus SugarBean

$related_id string

id or SugarBean to unrelate. Pass a SugarBean if you have it.

Returns
Type Description
boolean true if delete was successful or false if it was not
methodpublicget(  $role = false ) : array
inherited

Inherited from: \Link2::get()
Parameters
Name Type Description
$role
Returns
Type Description
array ids of records related through this link
methodpublicgetBeans( array $params = array() ) : array
inherited

Use with caution as if you have a large list of beans in the relationship, it can cause the app to timeout or run out of memory.

Inherited from: \Link2::getBeans()
Parameters
Name Type Description
$params array

An array that can contain the following parameters:

  • where: An array with 3 key/value pairs. lhs_field: The name of the field to check search. operator: The operator to use in the search. rhs_value: The value to search for.
    Example:
     'where' => array( 'lhs_field' => 'source', 'operator' => '=', 'rhs_value' => 'external' )
  • limit: The maximum number of beans to load.
  • deleted: If deleted is set to 1, only deleted records related to the current record will be returned.
Returns
Type Description
array of SugarBeans related through this link.
methodpublicgetFocus( ) : \SugarBean
inherited

Inherited from: \Link2::getFocus()
Returns
Type Description
\SugarBean The parent Bean this link references
methodpublicgetJoin( \$params $params, bool $return_array = false ) : \string/array

This method changes join of any item to campaign through target list if you want to use this join method you should add code below to your vardef.php 'link_class' => 'ProspectLink', 'link_file' => 'modules/Campaigns/ProspectLink.php'

Parameters
Name Type Description
$params \$params

array of parameters. Possible parameters include: 'join_table_link_alias': alias the relationship join table in the query (for M2M relationships), 'join_table_alias': alias for the final table to be joined against (usually a module main table)

$return_array bool

if true the query is returned as a array broken up into select, join, where, type, rel_key, and joined_tables

Returns
Type Description
\string/array join query for this link
Details
See
\Link::getJoin  
methodpublicgetQuery( array $params = array() ) : \String/Array
inherited

Inherited from: \Link2::getQuery()
Parameters
Name Type Description
$params array

optional parameters. Possible Values; 'return_as_array': returns the query broken into

Returns
Type Description
\String/Array query to grab just ids for this relationship
methodprotectedgetRelatedBean( bool $id = false ) : \SugarBean
inherited

Returns a SugarBean with the given ID from the related module.

Inherited from: \Link2::getRelatedBean()
Parameters
Name Type Description
$id bool

id of related record to retrieve

Returns
Type Description
\SugarBean
methodpublicgetRelatedField(  $name ) : \The
inherited

Inherited from: \Link2::getRelatedField()
Parameters
Name Type Description
$name
Returns
Type Description
\The value for the relationship field $name
methodpublicgetRelatedFields( ) : \list
inherited

Inherited from: \Link2::getRelatedFields()
Returns
Type Description
\list of fields that exist only on the relationship
methodpublicgetRelatedModuleLinkName( ) : string
inherited

Inherited from: \Link2::getRelatedModuleLinkName()
Returns
Type Description
string the name of the link field used on the other side of the rel
methodpublicgetRelatedModuleName( ) : string
inherited

Inherited from: \Link2::getRelatedModuleName()
Returns
Type Description
string the name of the module on the other side of this link
methodpublicgetRelatedTableName( ) : string
inherited

Inherited from: \Link2::getRelatedTableName()
Returns
Type Description
string name of table for the relationship of this link
methodpublicgetRelationshipObject( ) : \SugarRelationship
inherited

Inherited from: \Link2::getRelationshipObject()
Returns
Type Description
\SugarRelationship the relationship object this link references
methodpublicgetSide( ) : string
inherited

Inherited from: \Link2::getSide()
Returns
Type Description
string "LHS" or "RHS" depending on the side of the relationship this link represents
methodpublicgetSubpanelQuery( \$params $params = array(), bool $return_array = false ) : \string/array
inherited

This function is similair getJoin except for M2m relationships it won't join agaist the final table.

Inherited from: \Link2::getSubpanelQuery()

Its used to retrieve the ID of the related beans only

Parameters
Name Type Description
$params \$params

array of parameters. Possible parameters include: 'return_as_array': returns the query broken into

$return_array bool

same as passing 'return_as_array' into parameters

Returns
Type Description
\string/array query to use when joining for subpanels
methodpublicgetType( ) : string
inherited

Inherited from: \Link2::getType()
Returns
Type Description
string "many" if multiple records can be related through this link or "one" if at most, one record can be related.
methodpublicisParentRelationship( ) : bool
inherited

Inherited from: \Link2::isParentRelationship()
Returns
Type Description
bool true if this link represents a relationship where the parent could be one of multiple modules. (ex. Activities parent)
methodprotectedis_self_relationship( ) : bool
inherited

Inherited from: \Link2::is_self_relationship()
Returns
Type Description
bool true if LHSModule == RHSModule
methodpublicload(  $params = array() ) : void
inherited

Forces the link to load the relationship rows.

Inherited from: \Link2::load()

Will be called internally when the $rows property is accessed or get() is called

Parameters
Name Type Description
$params
methodpublicloadedSuccesfully( ) : bool
inherited

Returns false if no relationship was found for this link

Inherited from: \Link2::loadedSuccesfully()
Returns
Type Description
bool
methodpublicquery( array $params ) : void
inherited

Perform a query on this relationship.

Inherited from: \Link2::query()
Parameters
Name Type Description
$params array

An array that can contain the following parameters:

  • where: An array with 3 key/value pairs. lhs_field: The name of the field to check search. operator: The operator to use in the search. rhs_value: The value to search for.
    Example:
     'where' => array( 'lhs_field' => 'source', 'operator' => '=', 'rhs_value' => 'external' )
  • limit: The maximum number of rows
  • deleted: If deleted is set to 1, only deleted records related to the current record will be returned.
methodpublicrelationship_exists( \$table_name $table_name, \$join_key_values $join_key_values ) : bool
inherited

Directly queries the databse for set of values. The relationship classes and not link should handle this.

Inherited from: \Link2::relationship_exists()
Parameters
Name Type Description
$table_name \$table_name

string relationship table

$join_key_values \$join_key_values

array of key=>values to identify this relationship by

Returns
Type Description
bool true if the given join key set exists in the relationship table
methodpublicremoveBean( \SugarBean $bean ) : void
inherited

Remove a bean object from the list of beans currently loaded to this relationship.

Inherited from: \Link2::removeBean()

This for the most part should not need to be called except by the relatipnship implementation classes.

Parameters
Name Type Description
$bean \SugarBean
Documentation was generated by DocBlox 0.18.1.