/** mappatura proprietà scheda */ public static function map(Scheda $scheda, array $properties) { if (array_key_exists('ID', $properties)) { $scheda->setID($properties['ID']); } if (array_key_exists('ANNO', $properties)) { $scheda->setANNO($properties['ANNO']); } if (array_key_exists('APIARIO', $properties)) { $scheda->setAPIARIO($properties['APIARIO']); } if (array_key_exists('ALVEARE', $properties)) { $scheda->setALVEARE($properties['ALVEARE']); } if (array_key_exists('N_API', $properties)) { $scheda->setN_API($properties['N_API']); } if (array_key_exists('N_FAVI', $properties)) { $scheda->setN_FAVI($properties['N_FAVI']); } if (array_key_exists('SUPERFICIE', $properties)) { $scheda->setSUPERFICIE($properties['SUPERFICIE']); } if (array_key_exists('MIELE', $properties)) { $scheda->setMIELE($properties['MIELE']); } if (array_key_exists('N_CELLEREALI', $properties)) { $scheda->setN_CELLEREALI($properties['N_CELLEREALI']); } if (array_key_exists('N_MELARI', $properties)) { $scheda->setN_MELARI($properties['N_MELARI']); } if (array_key_exists('NOTE', $properties)) { $scheda->setNOTE($properties['NOTE']); } if (array_key_exists('DATASCHEDA', $properties)) { $scheda->setDATASCHEDA($properties['DATASCHEDA']); } if (array_key_exists('IDUTENTE', $properties)) { $scheda->setIDUTENTE($properties['IDUTENTE']); } if (array_key_exists('DATAREGISTRAZIONE', $properties)) { $scheda->setDATAREGISTRAZIONE($properties['DATAREGISTRAZIONE']); } if (array_key_exists('REGINA', $properties)) { $scheda->setREGINA($properties['REGINA']); } if (array_key_exists('IDCOLOREREGINA', $properties)) { $scheda->setIDCOLOREREGINA($properties['IDCOLOREREGINA']); } if (array_key_exists('DELETED', $properties)) { $scheda->setDELETED($properties['DELETED']); } }
/** convalida l'istanza scheda */ public static function validate(Scheda $scheda) { $errors = array(); if (!trim($scheda->getANNO())) { $errors[] = new Error('ANNO', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getAPIARIO())) { $errors[] = new Error('APIARIO', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getALVEARE())) { $errors[] = new Error('ALVEARE', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getN_API())) { $errors[] = new Error('N_API', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getN_FAVI())) { $errors[] = new Error('N_FAVI', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getSUPERFICIE())) { $errors[] = new Error('SUPERFICIE', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getN_CELLEREALI())) { $errors[] = new Error('CELLEREALI', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getN_MELARI())) { $errors[] = new Error('N_MELARI', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getNOTE())) { $errors[] = new Error('NOTE', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getDATASCHEDA())) { $errors[] = new Error('DATASCHEDA', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getREGINA())) { $errors[] = new Error('REGINA', 'Nessun inserimento o non valido.'); } if (!trim($scheda->getIDCOLOREREGINA())) { $errors[] = new Error('IDCOLOREREGINA', 'Nessun inserimento o non valido.'); } return $errors; }