コード例 #1
0
ファイル: MetaDataProperty.php プロジェクト: clevis/orm
 /**
  * @param MetaData
  * @param string
  * @param array|string
  * @param int MetaData::READ MetaData::READWRITE
  * @param string|NULL internal Od jake entity tento parametr existuje.
  */
 public function __construct(MetaData $meta, $name, $types, $access = MetaData::READWRITE, $since = NULL)
 {
     $this->class = $meta->getEntityClass();
     if (!preg_match('#^[a-zA-Z0-9_]+$#', $name)) {
         throw new MetaDataException("{$this->class} property name must be non-empty alphanumeric string, '{$name}' given");
     }
     $this->name = $name;
     $this->data['since'] = $since;
     $this->setTypes($types);
     $this->setAccess($access, $meta);
 }
コード例 #2
0
ファイル: AnnotationMetaData.php プロジェクト: clevis/orm
 /**
  * @param MetaData
  * @param AnnotationsParser
  */
 protected function __construct(MetaData $metaData, AnnotationsParser $parser)
 {
     $this->parser = $parser;
     $this->class = $metaData->getEntityClass();
     foreach ($this->getClasses($this->class) as $class) {
         foreach ($this->getAnnotation($class) as $annotation => $tmp) {
             if (isset(self::$modes[$annotation])) {
                 foreach ($tmp as $string) {
                     $this->addProperty($metaData, $string, self::$modes[$annotation], $class);
                 }
                 continue;
             }
             if (strncasecmp($annotation, 'prop', 4) === 0) {
                 $string = current($tmp);
                 throw new AnnotationMetaDataException("Invalid annotation format '@{$annotation} {$string}' in {$class}");
             }
         }
     }
 }