示例#1
0
 /**
  * @return string[]
  * @throws PersistException
  * */
 public function getAttrsDoc()
 {
     $attrs = parent::getAttrsDoc();
     /* os attrs agora passam a ser opcionais */
     if (!count($attrs)) {
         return;
     }
     $attrList = array();
     foreach ($attrs as $attr) {
         $attr = preg_replace('/(?:@attr\\s*\\(|[\\/\\*\\n\\r\\t\\s"]*|\\)$)/m', '', $attr);
         $tmpAttr = array();
         $attr = explode(',', $attr);
         foreach ($attr as $prop) {
             $data = explode('=', $prop);
             $name = current($data);
             $value = next($data);
             $tmpAttr[$name] = $value;
         }
         # ignora os campos que nao tenha anotacao definida
         if (!$this->_reflection->getName()) {
             continue;
         }
         if (isset($tmpAttr['name'])) {
             $attrList[$tmpAttr['name']] = $tmpAttr;
         }
     }
     $attrs = $attrList;
     return $attrs;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function translante(\br\gov\sial\core\util\Annotation $annon, array $list = NULL)
 {
     $fields = array();
     $arrList = (array) $annon->getAttrsDoc();
     foreach ($list as $elm) {
         $elm = trim($elm);
         if (isset($arrList[$elm]) && isset($arrList[$elm]['database'])) {
             $fields[$elm] = $arrList[$elm]['database'];
         }
     }
     return $fields;
 }
示例#3
0
 /**
  * Monta o conteudo do arquivo de cache
  *
  * @param Annotation $annon
  * @return string
  * */
 public function encodeAnnotation(Annotation $annon)
 {
     $content = array('class' => self::NAMESPACE_SEPARATOR . $annon->getClassName());
     $tmpEntity = $annon->getClassDoc();
     $content['attrs'] = $annon->getAttrsDoc();
     foreach ($tmpEntity as $key => $value) {
         $content[$key] = $value;
     }
     return json_encode($content);
 }