getDefinition() public méthode

Gets the entity definition.
public getDefinition ( ) : EntityDefinition
Résultat EntityDefinition the definition
Exemple #1
0
 /**
  * Constructor.
  *
  * @param string $usernameField
  * the username
  *
  * @param string $passwordField
  * the password (hash)
  *
  * @param string $saltField
  * the password hash salt
  *
  * @param Entity $userEntity
  * the actual user data
  *
  * @param array $roles
  * the roles
  */
 public function __construct($usernameField, $passwordField, $saltField, Entity $userEntity, array $roles)
 {
     $this->usernameField = $usernameField;
     $this->passwordField = $passwordField;
     $this->saltField = $saltField;
     // We have to copy it over as symfony/security wants something serializable.
     $this->userData = [];
     foreach ($userEntity->getDefinition()->getFieldNames() as $field) {
         $this->userData[$field] = $userEntity->get($field);
     }
     $this->roles = $roles;
 }
Exemple #2
0
 /**
  * Constructor.
  *
  * @param Entity $entity
  * the entity to validate
  */
 public function __construct(Entity $entity)
 {
     $this->entity = $entity;
     $this->definition = $entity->getDefinition();
 }
 /**
  * Constructs a file system path for the given parameters for storing the
  * file of the file field.
  *
  * @param string $entityName
  * the entity name
  * @param Entity $entity
  * the entity
  * @param string $field
  * the file field in the entity
  *
  * @return string
  * the constructed path for storing the file of the file field
  */
 protected function getPath($entityName, Entity $entity, $field)
 {
     return $this->basePath . $entity->getDefinition()->getField($field, 'path') . '/' . $entityName . '/' . $entity->get('id') . '/' . $field;
 }
 /**
  * Gets the S3 key of a file field.
  *
  * @param Entity $entity
  * the entity having the field
  * @param string $entityName
  * the name of the entity
  * @param string $field
  * the file field
  *
  * @return string
  * the key
  */
 protected function getKey(Entity $entity, $entityName, $field)
 {
     return $entity->getDefinition()->getField($field, 'path') . '/' . $entityName . '/' . $entity->get('id') . '/' . $field;
 }