4D v18

entity.getDataClass( )

Accueil

 
4D v18
entity.getDataClass( )

entity.getDataClass( )  


 

La méthode entity.getDataClass( ) retourne la dataclass de l'entité. Cette méthode est utile pour l'écriture du code générique.

Exemple  

  //méthode duplicate_entity
  //duplicate_entities($1)
  //duplicate_entities(entity)
 
 C_OBJET($1;$entity;$entityNew;$status)
 $entity:=$1 //reçoit l'entité à dupliquer dans $1
 $entityNew:=$entity.getDataClass().new() //crée une nouvelle entité dans la dataclass parente
 $entityNew.fromObject:=($entity.toObject())  //lire tous les attributs
 $entityNew[$entity.getDataClass().getInfo().primaryKey]:=Null // réinitialise la clé primaire
 $status:=$entityNew.save() // sauvegarde l'entité dupliquée



Voir aussi  


entitySelection.getDataClass( )

 
PROPRIÉTÉS 

Produit : 4D
Thème : ORDA - Entity
Nom intl. : entity.getDataClass( )

 
PAGE CONTENTS 
 
HISTORIQUE 

 
UTILISATION DE L'ARTICLE

4D - Langage ( 4D v18)