1
votes

I'm using KJSencha module for Zend Framework 2 to work with ExtJS. Module was configured according to documentation. All other things work great.

My application have to modules - Application and Backend. Application is empty, but with defined layout.phtml. Backend module has index.phtml and IndexController with empty indexAction().

There are three models in Backend\Direct\Model: Object, Single and Collection. They are used for Direct.

Backend\config\module.config.php

'kjsencha' => array(
    'direct' => array(
        'services' => array(
            'Direct.Tree' => 'Backend\Direct\Model\Tree',
            'Direct.Single' => 'Backend\Direct\Model\Object',
            'Direct.Collection' => 'Backend\Direct\Model\Collection',
        ),
    ),
)

I want to make Object->update() to be a form handler.

I spent some hours to find the reason, but apiBuilder still doesn't append 'formHandler: true' to my method.

Are there any things to do except this?

namespace Backend\Direct\Model;

class Object extends \Backend\Direct\Entity
{
    // .....

    /**
     * @\KJSencha\Annotation\Formhandler
     *
     */

    public function update($entity, $id)
    {
        // TODO: Implement update() method.
        return array();
    }
    // .....
}

Application\view\layout\layout.phtml

<?php
    echo $this->doctype(); ?>
<html lang="en">
<head>
    <meta charset="utf-8">
    <?php echo $this->headTitle('PROM-PC v.2') ?>
<?php

    echo $this->headLink();
    echo $this->headScript();
    ?>
</head>
<body>
<?php

    echo $this->content;
    echo $this->inlineScript();
?>

</body>
</html>

Backend\view\backend\index\index.phtml

<?php

$this->extJs()->loadLibrary();

// load custom variables set in configuration
$this->kjSenchaVariables();

// add loader configuration, which tells where ExtJs classes have to be loaded from
$this->kjSenchaLoaderConfig();

// preloads modules required to get the app running
$this->kjSenchaDirectApi();

// loads your actual application script (usually at the end of your body tag)
$this->inlineScript()->appendFile($this->basepath() . '/backend/js/app.js');

This is the result:

Ext.direct.Manager.addProvider({"type":"kjsenchamoduleremoting","url":"\/kjsencha\/rpc\/","actions":{"Direct.Tree":[{"name":"read","len":2},{"name":"update","len":2},{"name":"create","len":2},{"name":"destroy","len":2}],"Direct.Single":[{"name":"read","len":2},{"name":"create","len":2},{"name":"update","len":2},{"name":"destroy","len":2}],"Direct.Collection":[{"name":"read","len":2},{"name":"create","len":2},{"name":"update","len":2},{"name":"destroy","len":2}],"KJSencha.echo":[{"name":"__construct","len":1},{"name":"greet","len":1}]}});
1

1 Answers

0
votes

This is the same problem Zend_Reflection doesn't get the docblock for certain classes

Solution: Try to convert the line endings from Windows to Unix style.

Is it a bug of Zend\Reflection?