phpPeanuts  2.2.0
phpPeanuts framework
 All Data Structures Namespaces Files Functions Variables
Public Member Functions | Static Public Member Functions | Data Fields
PntMultiValuePropertyDescriptor Class Reference

Inherits PntDerivedPropertyDescriptor.

Public Member Functions

 isMultiValue ()
 
 getCompulsory ()
 
 getInCopy ()
 
 setInCopy ()
 
 getHoldsDependents ()
 
 getIdPropertyDescriptor ()
 
 getTwin ()
 
 deriveValueFor ($obj, $filter=true)
 
 deriveValueNoCache ($obj, $filter=true)
 
 getMyFilter ($obj)
 
 getExtraFilter ($obj, $filter)
 
 releaseCacheOn ($obj)
 
 getTwinName ()
 
 setTwinName ($value)
 
 setDerivationPath ($value)
 
 getDerivationNav ()
 
 deriveUsingPathFor ($obj)
 
 mutateRelationFor_ids ($obj, $idsToAdd, $idsToRemove)
 
 getOnDelete ()
 
 setOnDelete ($letter)
 
 getRecurseDelete ()
 
 getVerifyOnDelete ()
 
- Public Member Functions inherited from PntDerivedPropertyDescriptor
 isDerived ()
 
 getTwin ()
 
 getPersistent ()
 
 getDbSortPaths ()
 
 getIdPropertyDescriptor ()
 
 isValueInOptionsOf ($obj, $filter=false)
 
 deriveValueFor ($obj, $filter=true)
 
 propagateValue_for ($value, $obj)
 
 getCompulsory ()
 
 getShortlistPath ()
 
 setShortlistPath ($value)
 
- Public Member Functions inherited from PntPropertyDescriptor
 __construct ($name, $type, $readOnly, $minValue, $maxValue, $minLength, $maxLength, $classDir)
 
 getName ()
 
 setName ($aString)
 
 isLegalType ($aString)
 
 getType ()
 
 setType ($aString)
 
 getReadOnly ()
 
 setReadOnly ($aValue)
 
 getMinValue ()
 
 setMinValue ($aValue)
 
 getMaxValue ()
 
 setMaxValue ($aValue)
 
 getMinLength ()
 
 setMinLength ($aValue)
 
 getMaxLength ()
 
 setMaxLength ($aValue)
 
 getPersistent ()
 
 getDbSortPaths ()
 
 setDbSortPaths ($paths)
 
 getClassDir ()
 
 setClassDir ($value)
 
 getOwner ()
 
 setOwner ($anPntClassDescriptor)
 
 getValueValidator ()
 
 getVisible ()
 
 setVisible ($value)
 
 getHoldsId ()
 
 getCompulsory ()
 
 isDerived ()
 
 isFieldProperty ()
 
 isTypePrimitive ()
 
 isMultiValue ()
 
 getIdPropertyDescriptor ()
 
 __toString ()
 
 getValueFor ($obj, $filter=true)
 
 setValue_for ($value, $obj)
 
 getOptionsFor ($obj, $filter=true)
 
 hasOptionsGetter ($obj)
 
 getOptionsFilter ($obj, $filter)
 
 deriveValueFor ($obj)
 
 propagateValue_for ($value, $obj)
 
 isValueInOptionsOf ($obj, $filter=false)
 
 isValue_in ($value, $someObjects)
 
 _getValueFor ($obj)
 
 _setValue_for ($value, $obj)
 
 _getOptionsFor ($obj)
 
 _deriveValueFor ($obj)
 
 _propagateValue_for ($value, $obj)
 
 _getValueValidator ()
 
- Public Member Functions inherited from PntDescriptor
 getName ()
 
 setName ($aString)
 
 getLabel ()
 
 setLabel ($aString)
 
 __toString ()
 
 toString ()
 

Static Public Member Functions

static getOnDeleteLabels ()
 

Data Fields

 $twinName
 
 $derivationPath
 
 $onDelete
 
- Data Fields inherited from PntDerivedPropertyDescriptor
 $shortlistPath
 
- Data Fields inherited from PntPropertyDescriptor
 $name
 
 $type
 
 $minValue
 
 $maxValue
 
 $minLength = 0
 
 $maxLength
 
 $readOnly
 
 $ownerName
 
 $classDir
 
 $isTypePrimitive
 
 $visible
 
- Data Fields inherited from PntDescriptor
 $name
 
 $label
 

Member Function Documentation

deriveUsingPathFor (   $obj)

method to be used for m to n relationships replacing getter methods only works for two step relations to & through pntDbObjects with id properties corrsponding to the steps and mapped to the database JOINs a relationship table and SELECTs on $this->id. $derivationPath must be set.

Parameters
Object$objthe object to derive the values for
PntSqlFilter$filterto apply, or boolean wheather to apply the first applicable global filter
Exceptions
PntReflectionError
deriveValueFor (   $obj,
  $filter = true 
)

Return the property value for the object Called if no getter method exists. If $filter===true it caches the results array in field with same name as property on object and returns cached array if field is set. !Cached values are not reset before returned

Parameters
PntObject$objThe object whose property value to answer
PntSqlFilter$filterto apply, or boolean wheather to use global filter
Returns
array of ::getType (dynamically typed) the property value
Exceptions
PntErrorfor primitive types, if no idProperty or if the types classDescriptor can not get values
deriveValueNoCache (   $obj,
  $filter = true 
)

Derives the property value for the object without caching

Parameters
PntObject$objThe object whose property value to answer
PntSqlFilterignoored
Returns
array of ::getType (dynamically typed) the property value
Exceptions
PntErrorfor primitive types, if no idProperty or if the types classDescriptor can not get values
getCompulsory ( )
Returns
boolean Wheather there must be values (currently not enforced by the UI framework)
getDerivationNav ( )
getExtraFilter (   $obj,
  $filter 
)
getHoldsDependents ( )
Returns
boolean wheather the values are dependents of the peanut. This is the case if the twin property is compulsory
getIdPropertyDescriptor ( )

Returns the propertyDescriptor of the corresponding id-Property this is the property of the type which is named as the ownerName, extended with 'Id'

Returns
PntPropertyDescriptor
getInCopy ( )
Returns
boolean wheather te values of this property should be recursively copied if the peanut is copied can be set value, default is $this->getRecurseDelete()
getMyFilter (   $obj)
Returns
PntSqlFilter or null if no id to filter by
Exceptions
PntReflectionErrorif not all of the properties in the (derivation)path have twins
getOnDelete ( )
Returns
string Return a letter identifying the action to be taken with respect to the properties values when the peanut is deleted.
static getOnDeleteLabels ( )
static
Returns
Array with onDelete labels by onDelete settings NB: verify has not yet been implemented and currently behaves like delete
getRecurseDelete ( )
Returns
boolean Wheather delete should recursively delete values
getTwin ( )

If a property implements a role in a relationship, the property that implements the role on the other side is its twin.

Returns
PntPropertyDescriptor The twin property in the relationship
getTwinName ( )

If a property implements a role in a relationship, the property that implements the role on the other side is its twin. If a properties type is not a primitive type, the default twin name is the owners name with the first letter in lower case.

Returns
The name of the twin property in the relationship
getVerifyOnDelete ( )
Returns
boolean Wheather the user interface should verify the recursive delete of values of this property, or some of their properties recursively
isMultiValue ( )
mutateRelationFor_ids (   $obj,
  $idsToAdd,
  $idsToRemove 
)

Method to update m to n relationship. Called by PntObjectSaveAction if no corrsponding update method or from update method ( $updatemethodName = $mToNproperty~>getName(). 'NtoMmodIds'; ) update methods have the same arguments as the last two arguments of this method. only works for two step relations to & through pntDbObjectswith id properties corrsponding to the steps and mapped to the database

You should avoid overlap between $idsToAdd and $idsToRemove because duplicate relations with ids in $idsToRemove will all be removed without respect to the number of (duplicate) ids in $idsToRemove. $derivationPath must be set.

Parameters
String$pathfrom $this to the m to n related objects (two steps, like the result of "$1ToNpropertyName.$nTo1propertyName")
Array$idsToAddids of the objects that should be added to the relation
Array$idsToRemoveids of the objets that should be removed from the relation
Exceptions
PntReflectionError
releaseCacheOn (   $obj)

Release the values cached on the object by ::deriveValueFor. After releasing ::deriveValueFor must re-derive the values the first time it is called for the object.

Parameters
PntObject$objThe object whose property value cache is to be released
setDerivationPath (   $value)

Only works wiht m to n relationships to & through pntDbObjects with id properties corrsponding to the steps and mapped to the database The path should not refer to the mToNproperty but to the corresponding 1ToNproperty whose type corresponds to the JOINed table, and from there to the nTo1property on that type. For example if the name of $mToNproperty is 'keywords', wich gives access to an array of objects of type Keyword. The path could then be 'keywordRelations.keyword'. Property keywordRelations would give access to an array of objects of type KeywordRelation and property KeywordRelation>>keyword would give access to one object of type Keyword.

Parameters
String$pathfrom a peanut whose property is described by $this to the m to n related objects. (two steps, like the result of "$1ToNpropertyName.$nTo1propertyName")
setInCopy ( )
setOnDelete (   $letter)

Sets what should happen to values of this property if the owning peanut is deleted If not set, nothing happens. If set to 'd' the delete will cascade to the property values. If set to 'c' the the owning peanut can only be deleted if the property has no values. If set to 'v' (verify) the user interface should verify the recursive delete with the user first. (in versions earlier then 2.0 this was not implemented)

setTwinName (   $value)
See Also
getTwinName() Setting null will override the default
Parameters
$valueString the twin name

Field Documentation

$derivationPath
$onDelete
$twinName

The documentation for this class was generated from the following file: