hasProperty() public method

public hasProperty ( string $name ) : boolean
$name string
return boolean
コード例 #1
0
ファイル: DataEntityFragment.php プロジェクト: Zarganwar/orm
 public function hasValue($name)
 {
     if (!$this->metadata->hasProperty($name)) {
         return FALSE;
     }
     $value = $this->_getValue($this->metadata->getProperty($name), $name, TRUE);
     return isset($value);
 }
コード例 #2
0
ファイル: MetadataParser.php プロジェクト: Vyki/orm
 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;
 }
コード例 #3
0
ファイル: AbstractEntity.php プロジェクト: nextras/orm
 public function hasValue($name)
 {
     if (!$this->metadata->hasProperty($name)) {
         return false;
     }
     return $this->internalHasValue($this->metadata->getProperty($name), $name);
 }
コード例 #4
0
ファイル: MetadataParser.php プロジェクト: nextras/orm
 protected function initPrimaryKey()
 {
     $primaryKey = array_values(array_filter(array_map(function (PropertyMetadata $metadata) {
         return $metadata->isPrimary && !$metadata->isVirtual ? $metadata->name : null;
     }, $this->metadata->getProperties())));
     if (empty($primaryKey)) {
         throw new InvalidStateException("Entity {$this->reflection->name} does not have defined any primary key.");
     } elseif (!$this->metadata->hasProperty('id') || !$this->metadata->getProperty('id')->isPrimary) {
         throw new InvalidStateException("Entity {$this->reflection->name} has to have defined \$id property as {primary} or {primary-proxy}.");
     }
     $this->metadata->setPrimaryKey($primaryKey);
 }