hasProperty() 공개 메소드

public hasProperty ( string $name ) : boolean
$name string
리턴 boolean
예제 #1
0
 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
 public function hasValue($name)
 {
     if (!$this->metadata->hasProperty($name)) {
         return false;
     }
     return $this->internalHasValue($this->metadata->getProperty($name), $name);
 }
예제 #4
0
 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);
 }