Implements interfaces:
The ArrayController class.
This is the Controller Layer object for managing arrays.
In Cocoa, the NSArrayController manages selection by index. They can do this because in the desktop world, once you've set up your array, it stays around forever. Thus when the user changes a textfield bound to the nth item in the array, it's simple to lookup the nth item and call the setValueForKey method on the nth item. However in the HTTP world (especially stateless PHP) we have to re-build or array each request. Thus, the nth item when you DREW the textfield might not be the nth item when you're pushing the new value from the text field back to the object!
So, our WFArrayController has some extra magic to help with this problem. First off, arrays in PHP are different than NSArrays in that they are a blending of an array and a dictionary. Since we always have associative arrays to work with, our WFArrayController will manage its content more as a dictionary and less as an array. Also, the selection will be managed by keeping a list of selected keys rather than indexes. What key will be used? Well, the WFArrayController also has an identifier property, which allows you to control which key(s) of the managed class is used for the selected keys. By default, the identifier property is WFArrayController::USE_ARRAY_INDEXES_AS_ID, which is a special flag to actually use numeric indexing. This way, the WFArrayController will act very similarly to a NSArrayController.
However, if you want the WFArrayController to manage your objects by ID, then you can set the identifier to another list of key(s).
Located in /framework/WFArrayController.php (line 41)
WFObject | --WFObjectController | --WFArrayController
Inherited from WFObjectController
WFObjectController::$automaticallyPreparesContent
WFObjectController::$class
WFObjectController::$content
WFObjectController::$decorators
Add an object to the array.
Add multiple objects to the array.
Add the passed object to the selection, if it exists in our array.
NOTE that this does NOT add the object to the arrayController's content, simply marks the passed object as selected.
Add the passed objects to the selection, if each exists in our array.
Simply calls addSelectedObject for each item in the passed array.
NOTE that this does NOT add the object to the arrayController's content, simply marks the passed object as selected.
Add the passed ids to the selected list.
Get the count of the managed objects.
Get all of the objects managed by this controller.
Clear all selected items.
Remove all selected objects from the array controller.
Remove all unselected objects from the array controller.
Iterator interface for WFArrayController.
Determine if an object is currently selected based on its hash.
Get a single string ID key for the passed object.
Convert the passed id or id list into a single-string-id-key.
Is the given identifier selected in the array?
Get an array of the values for the classIdentifiers for the object.
Insert a new instance of the managed class at the end of the contentArray.
NOTE: insert() requires that the value of WFArrayController::$class is a class, not an interface.
Iterator interface for WFArrayController.
Iterator interface for WFArrayController.
Get the object specified by the passed identifier.
Determine if an object is currently selected.
This is a convenient and fast way to determine if an object is selected in the array controller. Useful if you're iterating the "arrangedObjects" and want to see if an item is selected.
Prepare the controller's content.
Basically, this will make sure that the array contains an instance. If one doesn't, a new instance of the class will be created and added to the array.
Remove the passed object from the array.
Also obvioulsy removes the item from the selection.
NOTE: presently this works in non-indexed mode only.
NOTE: UNTESTED!!!
Remove the passed objects from the arrayController's selection.
Iterator interface for WFArrayController.
Get an array with the selected objects.
Get the selected object, or NULL if no objects are selected.
Get the count of the selection.
Return a list of the IDs of all selected objects.
If true, the array controller will always make sure that there is at least one object selected, as long as the array controller isn't empty.
Set the id key(s) used to generate Identifiers for the managed objects.
For instance, if the WFArrayController's class is Person, maybe you'd pass 'uid'. If the WFArrayController's class is MyTwoColumnPKObject, you'd pass array('col1', 'col2').
NOTE: calling this function resets the selection to EMPTY since the previous id's are no longer valid.
Pass an array of objects to use for this array.
Simply clears the current content and selection, then calls addObjects.
Set the selected items of the array.
Note: this will CLEAR the existing setting, and only the passed ids will be selected. To ADD to a selection, addSelectionIdentifiers.
If true, the array controller will automatically add all objects inserted to the selection.
Iterator interface for WFArrayController.
Inherited From WFObjectController
WFObjectController::__construct()
WFObjectController::checkObjectClass()
WFObjectController::content()
WFObjectController::decorateObject()
WFObjectController::prepareContent()
WFObjectController::selectedObjects()
WFObjectController::selection()
WFObjectController::setAutomaticallyPreparesContent()
WFObjectController::setClass()
WFObjectController::setContent()
WFObjectController::setDecorator()
WFObjectController::setDecorators()
WFObjectController::undecorateObject()
Inherited From WFObject
WFObject::__construct()
WFObject::exposedProperties()
WFObject::getClass()
WFObject::keyPathToTargetAndKey()
WFObject::setValueForKey()
WFObject::setValueForKeyPath()
WFObject::setValuesForKeys()
WFObject::validatedSetValueForKey()
WFObject::validatedSetValueForKeyPath()
WFObject::validateObject()
WFObject::validateValueForKey()
WFObject::validateValueForKeyPath()
WFObject::valueForKey()
WFObject::valueForKeyPath()
WFObject::valueForStaticKey()
WFObject::valueForStaticKeyPath()
WFObject::valueForTargetAndKeyPath()
WFObject::valueForUndefinedKey()
WFObject::valueForUndefinedStaticKey()
WFObject::valuesForKeyPaths()
WFObject::valuesForKeys()
WFObject::_valueForStaticKey()
WFObject::__toString()
Documentation generated on Thu, 14 May 2009 16:19:45 -0400 by phpDocumentor 1.4.2