Ejemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $i = 1;
     foreach ($this->getPaymentTypes() as $paymentTypeName) {
         $paymentType = new paymentType();
         $paymentType->setId($i++);
         $paymentType->setName($paymentTypeName);
         $paymentType->setOrganization($this->getReference('tsk-org'));
         $manager->persist($paymentType);
         $metadata = $manager->getClassMetaData(get_class($paymentType));
         $metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE);
         $manager->flush();
     }
 }
Ejemplo n.º 2
0
 public function getRecTemplate()
 {
     //reconciliation templates
     try {
         $stmt = $this->dbh->prepare("SELECT * FROM paymentgroup");
         /*** execute the prepared statement ***/
         $stmt->execute();
         /*** fetch the results ***/
         $result = $stmt->fetchAll();
         //prepare statement for retrieving group types
         $stmt2 = $this->dbh->prepare("SELECT taxCode as paymentTypeID, taxType as typeName FROM paymenttype WHERE paymentGroupID = :paymentGroupID");
         $result2 = "";
         // = mysqli_result::class;
         //initialise parameter
         $paymentGroupID = 0;
         /*** bind the paramaters ***/
         $stmt2->bindParam(':paymentGroupID', $paymentGroupID, PDO::PARAM_INT);
         $reconciliation = new reconciliation();
         $rarr = array();
         foreach ($result as $row) {
             //create paymentgroup objects and set default parameters
             $paymentGroup = new paymentGroup();
             $garr = array();
             $paymentGroup->setPaymentGroupID($row["paymentGroupID"]);
             $paymentGroup->setGroupName($row["groupName"]);
             //update bound variable and execute query
             $paymentGroupID = $row["paymentGroupID"];
             $stmt2->execute();
             $result2 = $stmt2->fetchAll();
             //initialise paymenttype object
             foreach ($result2 as $row2) {
                 $paymentType = new paymentType();
                 $paymentType->setPaymentTypeID($row2["paymentTypeID"]);
                 $paymentType->setTypeName($row2["typeName"]);
                 //add paymenttype obj to array of payment group
                 //$wrapper = array($row2["paymentTypeID"]=>$paymentType);
                 //array_push($garr,$wrapper);
                 $garr[$row2["paymentTypeID"]] = $paymentType;
                 //added for subscript 29/8/2015
             }
             $paymentGroup->setPaymentTypes($garr);
             //array_push($rarr, $paymentGroup);
             $rarr[$row["paymentGroupID"]] = $paymentGroup;
         }
         $reconciliation->setGroups($rarr);
         //var_dump($result2);
         //exit();
         return $reconciliation;
     } catch (PDOException $e) {
         echo $e->getMessage();
     }
 }