/** * Creates a new XML Entity Collection view instance with the specified * entity type * * @param MEntityDescription $entity The entity this collection will represent * * @return MXMLEntityCollectionView The newly created instance */ public function __construct(MEntityDescription $entity) { parent::__construct($entity->plural()); $this->entity = $entity; $this->fireFaults = false; $this->managedObjects = new MMutableDictionary(); $this->dynamicFields = new MMutableDictionary(); }
/** * * @param MString $fieldName * @param MXMLManagedObjectViewDataProvider $dataProvider * * @return void */ public function addDynamicField(MString $fieldName, MXMLManagedObjectViewDataProvider $dataProvider) { $this->dynamicFields->setObjectForKey($fieldName, $dataProvider); $dataType = $dataProvider->dataTypeForFieldWithName($this->managedObject(), $fieldName); $data = $dataProvider->dataForFieldWithName($this->managedObject(), $fieldName); $fieldElement = new MXMLElementView($fieldName, $data ? $data->toString() : S("")); $fieldElement->setValueForProperty(S("type"), $dataType); $this->addSubview($fieldElement); $this->dynamicFieldViews->setObjectForKey($fieldName, $fieldElement); }