Exemplo n.º 1
0
 function generateBeforeContent($code_writer)
 {
     foreach ($this->_getExpressionsInTargetAttribute() as $expression) {
         $dbe = new WactDataBindingExpressionNode($expression, $this, $this->parent);
         $datasource = $dbe->getDatasourceContext();
         $field_name = $dbe->getFieldName();
         if ($field_name && !$datasource->isDatasource()) {
             $this->raiseCompilerError('Wrong datasource path in target or to attribute', array('expression' => $expression));
         }
         if (count($dbe->getPathToTargetDatasource())) {
             $this->raiseCompilerError('Path based variable is not supported in target or to attribute', array('expression' => $expression));
         }
         $code_writer->writePHP($datasource->getComponentRefCode() . '->registerDatasource(');
         $this->attributeNodes['from']->generateExpression($code_writer);
         $code_writer->writePHP(');' . "\n");
     }
 }
Exemplo n.º 2
0
 protected function _processTargetAttribute($code_writer)
 {
     foreach ($this->_getExpressionsFromTargetAttribute() as $expression) {
         $dbe = new WactDataBindingExpressionNode($expression, $this, $this->parent);
         $datasource = $dbe->getDatasourceContext();
         $field_name = $dbe->getFieldName();
         if ($field_name && !$datasource->isDatasource()) {
             $this->raiseCompilerError('Wrong DBE datasource context in buffer attribute', array('expression' => $expression));
         }
         if (count($dbe->getPathToTargetDatasource())) {
             $this->raiseCompilerError('Path based variable name is not supported in buffer attribute', array('expression' => $expression));
         }
         $dbe->generatePreStatement($code_writer);
         $code_writer->writePHP($this->getComponentRefCode() . '->addBuffer(');
         $code_writer->writePHP($datasource->getComponentRefCode());
         if ($field_name) {
             $code_writer->writePHP(', "' . $field_name . '"');
         }
         $code_writer->writePHP(');' . "\n");
         $dbe->generatePostStatement($code_writer);
     }
 }