Nextras\Orm\Entity\Reflection\EntityMetadata::getProperty PHP Method

getProperty() public method

public getProperty ( string $name ) : PropertyMetadata
$name string
return PropertyMetadata
    public function getProperty($name)
    {
        if (!isset($this->properties[$name])) {
            throw new InvalidArgumentException("Undefined property {$this->className}::\${$name}.");
        }
        return $this->properties[$name];
    }

Usage Example

Example #1
0
 public function parseMetadata($class, &$fileDependencies)
 {
     $this->reflection = new ClassType($class);
     $this->metadata = new EntityMetadata($class);
     $this->primaryKey = [];
     $this->loadProperties($fileDependencies);
     $this->loadGettersSetters();
     // makes id property virtual on entities with composite primary key
     if ($this->primaryKey && $this->metadata->hasProperty('id')) {
         $this->metadata->getProperty('id')->isVirtual = TRUE;
     }
     $fileDependencies = array_unique($fileDependencies);
     $this->metadata->setPrimaryKey($this->primaryKey ?: ['id']);
     return $this->metadata;
 }
All Usage Examples Of Nextras\Orm\Entity\Reflection\EntityMetadata::getProperty