1. #1
    Ext JS Premium Member oaugustus's Avatar
    Join Date
    May 2007
    Location
    Belo Horizonte, Brazil
    Posts
    66
    Vote Rating
    2
    oaugustus is on a distinguished road

      1  

    Default ExtDirect bundle for Symfony2

    ExtDirect bundle for Symfony2


    Hi all,

    I have implemented an ExtDirect specification for Symfony2 framework. It is a Symfony2 bundle. To whoever is interested the code is in GitHub and documentation link is in Readme. Follow the link https://github.com/oaugustus/DirectBundle

    []s
    Otávio Augusto Rodrigues Fernandes
    Net On - Soluções Tecnológicas Ltda
    Desenvolvimento e Consultoria em ExtJS
    www.neton.com.br
    otavio@neton.com.br
    (31) 3075-7868

  2. #2
    Sencha User Jehu's Avatar
    Join Date
    Feb 2011
    Posts
    24
    Vote Rating
    0
    Jehu is on a distinguished road

      0  

    Default


    Thank you so much, very helpful.

  3. #3
    Sencha User Jehu's Avatar
    Join Date
    Feb 2011
    Posts
    24
    Vote Rating
    0
    Jehu is on a distinguished road

      0  

    Default


    There is an error (i use Symfony version 2.0.0-DEV.):

    PHP Code:
    Class Neton\DirectBundle\DependencyInjection\DirectExtension contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Symfony\Component\DependencyInjection\Extension\ExtensionInterface::loadin /opt/lampp/htdocs/project/src/Neton/DirectBundle/DependencyInjection/DirectExtension.php on line 89 
    I think, you need to rename the method configLoad() to load() in DependencyInjection/DirectExtension.php

  4. #4
    Ext JS Premium Member oaugustus's Avatar
    Join Date
    May 2007
    Location
    Belo Horizonte, Brazil
    Posts
    66
    Vote Rating
    2
    oaugustus is on a distinguished road

      0  

    Default


    Hi Jehu,

    Realy I have created a new project based on symfony-sanbox and the reported error happening. The error occur beacuse a change on \Symfony\Component\DependencyInjection\Extension class. I have fixed this error to DirectBundle work on the new sandbox release. The code is avaiable on github repository.

    Thank you very much for report.
    Otávio Augusto Rodrigues Fernandes
    Net On - Soluções Tecnológicas Ltda
    Desenvolvimento e Consultoria em ExtJS
    www.neton.com.br
    otavio@neton.com.br
    (31) 3075-7868

  5. #5
    Sencha User
    Join Date
    Oct 2010
    Location
    Cusco
    Posts
    11
    Vote Rating
    0
    jorgelive is on a distinguished road

      0  

    Red face Can't make it work

    Can't make it work


    Hello:

    I've just cloned the latest symfony2 sandbox from git,

    My only change to the default configurations was:

    direct:
    api:
    url: http://192.168.2.80/app.php/route

    but when I put in the browser:
    http://192.168.2.252/app.php/api.js => it responds 503 Service Unavailable
    If i putExt.Direct.addProvider({"url":"http:\/\/192.168.2.252\/app.php\/route","type":"remoting","namespace":"Actions","id":"API","actions":[]});

    It has not mapping actions, they're empty, but i need the production mode.

    I already put mapping comments to my actions

    PHP Code:
     <?php

    namespace Cotizaciones\CotizacionBundle\Controller;   ///????
    namespace Neton\CotizacionBundle\Controller///???
    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    class 
    CotizacionController extends Controller
    {
        
    /*
        * Single exposed method.
        *
        * @remote    // this annotation expose the method to API
        * @param  array $params
        * @return string
        */
        
    public function indexAction($params)
        {
            return 
    'Hello '.$params['name'];
    Is it necesary to use
    namespace Neton\CotizacionBundle\Controller; ??

    instead of my default one:
    namespace Cotizaciones\CotizacionBundle\Controller;

    can I use them both? i think not.

    I already tried with/without/both ways.

    but the api.js in dev mode is always empty or 503 in production mode.

    my configuration files are:

    routing.yml:

    cotizacion:
    resource: "@CotizacionBundle/Resources/config/routing.yml"
    direct:
    resource: "@DirectBundle/Resources/config/routing.yml"


    config.yml
    ....
    twig:
    debug: %kernel.debug%
    strict_variables: %kernel.debug%

    # Direct Configuration
    direct:
    api:
    url: http://192.168.2.252/app.php/route # required
    #remote_attrinute: '@remote' default value, not required
    #form_attribute: '@form' default value, not required
    #type: remoting default value, not required
    #namespace: Actions default value, not required
    #id: API default value, not required

    autoload.php

    'Sensio' => __DIR__.'/../src',
    'Neton' => __DIR__.'/../src',
    'Cotizaciones' => __DIR__.'/../src',

    AppKernel.php

    // register your bundles
    new Sensio\HelloBundle\HelloBundle(),
    new Neton\DirectBundle\DirectBundle(),
    new Cotizaciones\CotizacionBundle\CotizacionBundle(),

    Thanks.

  6. #6
    Ext JS Premium Member oaugustus's Avatar
    Join Date
    May 2007
    Location
    Belo Horizonte, Brazil
    Posts
    66
    Vote Rating
    2
    oaugustus is on a distinguished road

      0  

    Default


    Hi jorgelive,

    What is your symfony version in sandbox? My version is "Symfony version 2.0.0-DEV - app/dev" with php console -V command line. Realy there was a broken method call in DirectBundle Api class that prevented API creation from production enviroment, I have fixed it and the fixed code already is avaiable on Github. About the namespace, you can use only one namespace per file in this case. I have cloned the sandbox again to test the bundle and it works see the result:

    PHP Code:
    namespace Sensio\HelloBundle\Controller;

    use 
    Symfony\Bundle\FrameworkBundle\Controller\Controller;

    class 
    HelloController extends Controller
    {
        public function 
    indexAction($name)
        {
            return 
    $this->render('HelloBundle:Hello:index.html.twig', array('name' => $name));

            
    // render a PHP template instead
            // return $this->render('HelloBundle:Hello:index.html.php', array('name' => $name));
        
    }

        public function 
    welcomeAction()
        {
            return 
    $this->render('HelloBundle:Hello:welcome.html.twig');
        }

        
    /**
         * @remote
         */
        
    public function myAction()
        {
            
        }

    Code:
    Ext.Direct.addProvider({"url":"http:\/\/localhost\/symfony-test\/symfony-sandbox\/web\/app.php\/route","type":"remoting","namespace":"Actions","id":"API","actions":{"Hello_Hello":[{"name":"my","len":1}]}});
    What is your OS version to I test in it?
    Otávio Augusto Rodrigues Fernandes
    Net On - Soluções Tecnológicas Ltda
    Desenvolvimento e Consultoria em ExtJS
    www.neton.com.br
    otavio@neton.com.br
    (31) 3075-7868

  7. #7
    Sencha User
    Join Date
    Oct 2010
    Location
    Cusco
    Posts
    11
    Vote Rating
    0
    jorgelive is on a distinguished road

      0  

    Cool is_dir() problem

    is_dir() problem


    Solved changing:

    $dir = $bundle->getPath()."\\Controller";

    to

    $dir = $bundle->getPath()."/Controller";

    for php function is_dir()

    in for ControllerFinder.php

    Using:
    Zend Server Php 5.3.2
    SLES11 x86_64

    Thanks

  8. #8
    Ext JS Premium Member oaugustus's Avatar
    Join Date
    May 2007
    Location
    Belo Horizonte, Brazil
    Posts
    66
    Vote Rating
    2
    oaugustus is on a distinguished road

      0  

    Default


    Hi jorgelive,

    Thank you very much for report. I have fixed this mistake at repository.

    Thanks again.
    Otávio Augusto Rodrigues Fernandes
    Net On - Soluções Tecnológicas Ltda
    Desenvolvimento e Consultoria em ExtJS
    www.neton.com.br
    otavio@neton.com.br
    (31) 3075-7868

  9. #9
    Sencha User
    Join Date
    Nov 2010
    Location
    Canton, GA, USA
    Posts
    20
    Vote Rating
    1
    pauldugas is on a distinguished road

      0  

    Default Trouble with 2.0.0PR9

    Trouble with 2.0.0PR9


    I'm a noob with SF2 so the trouble is most likely on my end but I figure I'd ask. I pulled the 2.0.0PR9 version of Symfony2 today and got the Demo going. Then I pulled in the DirectBundle via git and made the adjustments to app/autoload.php, app/AppKernel.php and app/config/routing.yml. Now, when I hit the /app_dev.php, I'm getting the following error:

    PHP Code:
    [Fri Apr 01 19:14:44 2011] [error] [client 127.0.0.1PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'Bundle "DirectBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() function of your AppKernel.php file?' in /var/www/Symfony/app/bootstrap.php.cache:608\nStack trace:\n#0 /var/www/Symfony/app/bootstrap.php.cache(634): Symfony\\Component\\HttpKernel\\Kernel->getBundle('DirectBundle', false)\n#1 /var/www/Symfony/vendor/symfony/src/Symfony/Component/HttpKernel/Config/FileLocator.php(45): Symfony\\Component\\HttpKernel\\Kernel->locateResource('@DirectBundle/R...', '/home/pdugas/wo...', true)\n#2 /var/www/Symfony/vendor/symfony/src/Symfony/Component/Config/Loader/FileLoader.php(60): Symfony\\Component\\HttpKernel\\Config\\FileLocator->locate('@DirectBundle/R...', '/home/pdugas/wo...')\n#3 /var/www/Symfony/vendor/symfony/src/Symfony/Component/Routing/Loader/YamlFileLoader.php(67): Symfony\\Component\\Config\\Loader\\FileLoader->import('@DirectBundle/R...', N in /var/www/Symfony/app/bootstrap.php.cache on line 608 
    Anybody got a suggestion on what I'm missing? Besides a clue

  10. #10
    Sencha User
    Join Date
    Nov 2010
    Location
    Canton, GA, USA
    Posts
    20
    Vote Rating
    1
    pauldugas is on a distinguished road

      0  

    Default Fix for PR9

    Fix for PR9


    Found it with the help on avalanche123 on the @synfony IRC channel.

    The lines in app/config/routing.yml should be:
    PHP Code:
    direct:
        
    resource"@Direct/Resources/config/routing.yml" 
    Seems a recent change in Symfony renamed some things.

    Edit: Need to replace "DirectBundle" with "Direct" in the bundle's own config/routing.yml as well.

Similar Threads

  1. Ext.i18n.Bundle Using Bundles now for Sencha Touch 1.0
    By elmasse in forum Sencha Touch 1.x: Examples and Showcases
    Replies: 14
    Last Post: 19 Jan 2012, 4:42 AM
  2. Resource Bundle
    By sundhar_v in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 16 Sep 2009, 7:38 AM
  3. Image Bundle in GXT
    By markrgli in forum Ext GWT: Discussion
    Replies: 1
    Last Post: 17 Aug 2009, 11:11 PM
  4. Is there an Ext.js 2.0 Textmate Bundle?
    By Dumbledore in forum Community Discussion
    Replies: 8
    Last Post: 10 Jan 2009, 6:31 PM
  5. Image bundle
    By papasi in forum Community Discussion
    Replies: 4
    Last Post: 2 Jul 2007, 1:04 AM

Thread Participants: 13