PHP |
---|
public function CreateDataCollection(object $collection , object $dataObject, array $rows) |
The collection must be an object that extends (inherits from) LJCCollectionLib.php class LJCCollectionBase and provides an AddObject method with the signature AddObject(DataObject $item, $key = null); Where DataObject is a strongly typed Data Object. See LJCDbAccessLib.php class LJCDbColumns and LJCDbColumn for examples.
The AddObject() method should supply a default key value or the method can be changed to require the programmer to enter it by removing the "= null" from the method signature.
The DataObject must supply a Clone() method.PHP |
---|
$webCommonPath = "c:/inetpub/wwwroot/LJCPHPCommon"; require_once "$webCommonPath/LJCDataManagerLib.php"; // See constructor for how to create $connectionValues. $manager = new LJCDataManager($connectionValues, "TableName"); class Person { public int $ID; public string $Name; } $rows = $manager->Load(null); $persons = $manager->CreateDataCollection(new Persons(), new Person() , $rows); foreach ($persons as $person) { echo $person->ID; echo $person->Name; } |