logo

$10
Installing sfJqueryTreeDoctrineManagerPlugin to Symfony 1.4

I have faced serious difficulties while installing sfJqueryTreeDoctrineManagerPlugin to Symfony 1.4 w/ Doctrine ORM. The installation directly from the server did not work out like with previous plugins that I have installed:

C:\path>symfony plugin:install sfJqueryTreeDoctrineManagerPlugin
plugin installing plugin "sfJqueryTreeDoctrineManagerPlugin"

No release available for plugin "sfJqueryTreeDoctrineManagerPlugin"


This is why I needed to install the plugin by downloading the tgz-archive and install it manually like this:

C:\path>symfony plugin:install "C:\path\to\downloads\sfJqueryTreeDoctrineManagerPlugin-1.2.4.tgz"
plugin installing plugin "C:\path\to\downloads\sfJqueryTreeDoctrineManagerPlugin-1.2.4.tgz"

sfSymfonyPluginManager Installing web data for plugin


I guess everything should be fine this far?

After that I edited \apps\admin\config\settings.yml like instructed in the plugins readme file.

all:
.settings:
enabled_modules: [default, sfJqueryTreeDoctrineManager]


I also checked that the plugin was enabled in \config\ProjectConfiguration.class.php like this:

$this->enablePlugins(array(
// other plugins,
'sfJqueryTreeDoctrineManagerPlugin'
));


I published assets and cleared cache:

C:\path>symfony plugin:publish-assets
>> plugin Configuring plugin - sfJqueryTreeDoctrineManagerPlugin
C:\path>symfony cc


Finally I added the required helper to the newly created apps\admin\modules\category\templates\indexSuccess.php

<?php
use_helper("sfJqueryTreeDoctrine");
echo get_nested_set_manager("Category", "name");


When loading the page I unfortunately get the following error:

500 | Internal Server Error | InvalidArgumentException
Unable to load "sfJqueryTreeDoctrineHelper.php" helper in: SF_ROOT_DIR\apps\admin\modules/businessunitgroup/lib/helper, SF_ROOT_DIR\apps\admin\lib/helper, SF_ROOT_DIR\lib/helper, SF_SYMFONY_LIB_DIR/helper.


The file sfJqueryTreeDoctrineHelper.php exists indeed but not in any previously mentioned folder. The file can only be found in the folder \plugins\sfJqueryTreeDoctrineManagerPlugin\lib\helper. I guess that Symfony doesn't look to that folder while finding helpers?

I have tried to move the helper file to one of the previously mentioned folders. As expected, that changes the error. Now I get:

500 | Internal Server Error | sfConfigurationException
The component does not exist: "sfJqueryTreeDoctrineManager", "manager".


Unfortunately I can't figure out how should I be able to retrieve the "missing" component from the correct folder.

I would be very grateful for any advice to help me forward.

By the way, I am aware that there are other nested-set / tree plugins available for Symfony (like sfDoctrineTreePlugin and caPropelTreePlugin) but unluckily those are either uncompatible or too limited for my needs.

Christine Q. | 06/03/10 at 7:23am | Edit


(3) Possible Answers Submitted...

  • avatar
    Last edited:
    06/09/10
    2:28am
    Martin Palacio says:

    What version of Windows are you using? Maybe it's a permissions issue, or a path-using-spaces one. Try to uninstall the plugin, move the tgz to your project folder and install it again.
    BTW what is your SF_ROOT_DIR?

    EDIT: I confirm that the plugin works on Ubuntu (installing the tgz as you did), but I slightly modified the part where the plugins are enabled:


    //ProjectConfiguration.class.php
    $this->enablePlugins('foo', 'bar', 'sfJqueryTreeDoctrineManagerPlugin');

    //instead of
    $this->enablePlugins(array('foo', 'bar', 'sfJqueryTreeDoctrineManagerPlugin'));

    Previous versions of this answer: 06/03/10 at 8:45am | 06/03/10 at 8:47am

    • 06/03/10 10:31am

      Christine Q. says:

      Thank you for your quick response.

      I use Windows XP as a normal user. I guess permission issue can be excluded, because I have granted myself full rights to the project folder (when I was logged in as an administrator). The project folder path (C:\svn\projectname) does not contain any spaces. That is the folder containing all the subfolders like apps, config, data, lib, plugins etc.

      Symfony itself is installed to C:\Program Files\BitNami WAPPStack\php\PEAR\symfony. That folder contains the subfolders like action, addon, autoload, cache, command etc. I realize this isn't the recommended way to install Symfony, but as part of a team I didn't make the decision myself. This means that Symfony's install path itself contains spaces. I hope this answered your question about SF_ROOT_DIR.

      I restored the project from SVN repository to a state before any sfJqueryTreeDoctrineManagerPlugin install attempts. Then I moved the plugin tgz-archive to C:\svn\projectname and installed it similarly like before:

      symfony plugin:install sfJqueryTreeDoctrineManagerPlugin-1.2.4.tgz


      This time, however, I got a little different response (the bolded line wasn't there last time):

      C:\path>symfony plugin:install sfJqueryTreeDoctrineManagerPlugin-1.2.4.tgz
      >> plugin installing plugin "sfJqueryTreeDoctrineManagerPlugin-1.2.4.tgz"
      >> sfSymfonyPluginManager Installation successful for plugin "sfJqueryTreeDoctri
      neManagerPlugin-1.2.4.tgz"

      >> sfSymfonyPluginManager Installing web data for plugin


      After that I used my TortoiseSVN client to compare, which files were installed. You can find the complete listing at http://pastebin.com/raw.php?i=ub1gMJ8V

      As you can see, the plugin extracted its files only to folders plugins/ and web/. Should it maybe have extracted something to some lib/ or helper/ folder?

      I also modified the ProjectConfiguration.class.php like you instructed but there was no effect with this plugin. However my previously installed plugins (sfDoctrinePlugin, sfDoctrineGuardPlugin, sfFormExtraPlugin, sfFormI18nNumberPlugin) continued working as usual.

    • 06/03/10 11:30am

      Martin Palacio says:

      Thank you for the detailed explanation. Your installation seems to be OK.
      Can you paste the full content of your ProjectConfiguration.class.php?

    • 06/03/10 12:00pm

      Martin Palacio says:

      I have some more thoughts.

      First of all, be sure that your plugin is loaded.


      //in ProjectConfiguration.class.php
      $this->enablePlugins('sfPropelPlugin', 'sfDoctrinePlugin', 'sfJqueryTreeDoctrineManagerPlugin');

      die(print_r($this->getPlugins()));



      this helped me sometimes:

      when everything fails, just clear the cache manually (delete everything under your /cache folder)

    • 06/03/10 12:00pm

      Martin Palacio says:

      I have some more thoughts.

      First of all, be sure that your plugin is loaded.


      //in ProjectConfiguration.class.php
      $this->enablePlugins('sfPropelPlugin', 'sfDoctrinePlugin', 'sfJqueryTreeDoctrineManagerPlugin');

      die(print_r($this->getPlugins())); //add this line and look for the result



      this helped me sometimes:

      when everything fails, just clear the cache manually (delete everything under your /cache folder)

    • 06/03/10 12:30pm

      Christine Q. says:

      Thank you for your suggestions. I already came home from work and I don't have the installation available here at home. I'll get back to work in 13.5 hours from now, so I'll try your suggestions then and let you know.

    • 06/04/10 3:29am

      Christine Q. says:

      My ProjectConfiguration.class.php looks like this:

      <?php

      require_once 'C:\\Program Files\\BitNami WAPPStack\\php\\PEAR\\symfony/autoload/sfCoreAutoload.class.php';
      sfCoreAutoload::register();

      class ProjectConfiguration extends sfProjectConfiguration
      {
      public function setup()
      {
      $this->enablePlugins('sfDoctrinePlugin',
      'sfJqueryTreeDoctrineManagerPlugin',
      'sfDoctrineGuardPlugin',
      'sfFormExtraPlugin',
      'sfFormI18nNumberPlugin');
      #die(print_r($this->getPlugins())); //add this line and look for the result
      }
      }


      The plugin seems to be loaded:

      C:\svn\projectname>symfony cc
      Array
      (
      [0] => sfDoctrinePlugin
      [1] => sfJqueryTreeDoctrineManagerPlugin
      [2] => sfDoctrineGuardPlugin
      [3] => sfFormExtraPlugin
      [4] => sfFormI18nNumberPlugin
      )

  • avatar
    Last edited:
    06/09/10
    2:28am
    José Antonio says:

    Hello Cristine Q.

    I never used the sfJqueryTreeDoctrineManagerPlugin but here you have an advised.

    Try to put the following code in the setup() function inside the sfJqueryTreeDoctrineManagerPluginConfiguration class:


    class sfJqueryTreeDoctrineManagerPluginConfiguration extends sfPluginConfiguration
    {
    const VERSION = '1.0.0-DEV';

    //You should write this code here....
    public function setup(){
    $this->initializeAutoload();
    }
    }


    Like this you are forcing the plugin to load its own lib's classes, for that you can call the get_nested_set_manager($model, $field, $root = 0) function whitout include the sfJqueryTreeDoctrineHelper, this is not the best way to solved the problem but meabe help us.

    Also check that you \apps\admin\config\settings.yml have the correct format, I don't think that have to see with you problem but you should check this...


    all:
    .settings:
    enabled_modules: [default, sfJqueryTreeDoctrineManager]


    I hope that can help you.

    Regards

    Previous versions of this answer: 06/03/10 at 8:58am | 06/03/10 at 9:51am

    • 06/03/10 10:42am

      Christine Q. says:

      Thank you for your response.

      The file \plugins\sfJqueryTreeDoctrineManagerPlugin\config\sfJqueryTreeDoctrineManagerPluginConfiguration.class.php looked originally like this (comments stripped away of course):

      <?php
      class sfJqueryTreeDoctrineManagerPluginConfiguration extends sfPluginConfiguration
      {
      const VERSION = '1.0.0-DEV';

      public function initialize()
      {
      }
      }


      I tried to replace the original initialize() function with the setup() function that you proposed like this:

      <?php
      class sfJqueryTreeDoctrineManagerPluginConfiguration extends sfPluginConfiguration
      {
      const VERSION = '1.0.0-DEV';

      public function setup(){
      $this->initializeAutoload();
      }
      }


      Then I tried to append your function after the original one:

      <?php
      class sfJqueryTreeDoctrineManagerPluginConfiguration extends sfPluginConfiguration
      {
      const VERSION = '1.0.0-DEV';

      public function initialize()
      {
      }

      public function setup(){
      $this->initializeAutoload();
      }
      }


      I even tried to modify the original function like this:

      <?php
      class sfJqueryTreeDoctrineManagerPluginConfiguration extends sfPluginConfiguration
      {
      const VERSION = '1.0.0-DEV';

      public function initialize()
      {
      $this->initializeAutoload();
      }
      }


      None of these had any effect. Of course I cleared the cache between every step with symfony cc. Every try resulted in the same old:

      500 | Internal Server Error | InvalidArgumentException
      Unable to load "sfJqueryTreeDoctrineHelper.php" helper in: SF_ROOT_DIR\apps\kassapp\modules/businessunitgroup/lib/helper, SF_ROOT_DIR\apps\kassapp\lib/helper, SF_ROOT_DIR\lib/helper, SF_SYMFONY_LIB_DIR/helper.


      I double checked the file \apps\admin\config\settings.yml for correct format and yes, it is okay. Also my previously installed plugins work.

    • 06/03/10 10:51am

      José Antonio says:

      Hi again,

      Please after alter the code:


      <?php

      class sfJqueryTreeDoctrineManagerPluginConfiguration extends sfPluginConfiguration

      {

      const VERSION = '1.0.0-DEV';



      public function initialize()

      {

      }



      public function setup(){

      $this->initializeAutoload();

      }

      }


      try to call the helper "get_nested_set_manager" in you template (apps\admin\modules\category\templates\indexSuccess.php) like I show you below:


      <?php

      // use_helper("sfJqueryTreeDoctrine"); -- Dont use this code....

      echo get_nested_set_manager("Category", "name");

    • 06/03/10 11:03am

      Christine Q. says:

      I updated both files as you instructed. Unfortunately I get now only this:

      Fatal error: Call to undefined function get_nested_set_manager() in C:\svn\projectname\apps\admin\modules\category\templates\indexSuccess.php on line 5

    • 06/03/10 11:55am

      José Antonio says:

      Hi Christine Q:

      I install the plugin in my environment and work correctly. I suggest you you check the follow steps, and meabe can find where is the problem by you own.

      1. Copy a folder whit the name "sfJqueryTreeDoctrineManagerPlugin" in the plugins directory of your project. Inside are the plugin's folders. (config, lib, etc...).
      2. Enable module sfJqueryTreeDoctrineManager in your settings.yml application config file. The same application where you are used the tree.
      3. Run the "symfony plugin:publish-assets" task.
      4. If you don't have in your project config file the lines (ProjectConfiguration.class.php)

      class ProjectConfiguration extends sfProjectConfiguration
      {
      public function setup()
      {
      $this->enableAllPluginsExcept(array('...', '...'));
      }
      }

      then enable the plugin
      class ProjectConfiguration extends sfProjectConfiguration
      {
      public function setup()
      {
      $this->enablePlugins(array('sfJqueryTreeDoctrineManagerPlugin'));
      }
      }

      5. Include the helper in you template:
      <?php 
      use_helper("sfJqueryTreeDoctrine");

      echo get_nested_set_manager("Category", "name");
      ?>

      6. Clear cache.
      7. Run the action in the browser.

      If all this features are OK and the problem persists, then try to access to the configuration of the halpers path to check if the route of the helpr plugin dir are loaded:
      //try to put this code in the template...
      print_r(sfContext::getInstance()->getConfiguration()->getHelperDirs());exit;
      use_helper("sfJqueryTreeDoctrine");
      echo get_nested_set_manager("Category", "name");

      then you execute this in the browser, look if in the array exist this address:

      Array
      (
      [0] => ...
      [3] => %SF_ROOT_DIR%/plugins/sfJqueryTreeDoctrineManagerPlugin/lib/helper
      [4] => ...
      )

      If this address no apear, then you know what is the real problem....
      Regards.

    • 06/03/10 12:30pm

      Christine Q. says:

      Thank you for your suggestions. I already came home from work and I don't have the installation available here at home. I'll get back to work in 13.5 hours from now, so I'll try your suggestions then and let you know.

    • 06/04/10 3:36am

      Christine Q. says:

      Looks like we have made some good advance and found the issue. I followed the steps you proposed but with no luck.

      When adding

      print_r(sfContext::getInstance()->getConfiguration()->getHelperDirs());exit;
      to indexSuccess.php template I get the following:

      Array
      (
      [0] => C:\svn\kassa\apps\kassapp\lib/helper
      [1] => C:\svn\kassa\lib/helper
      [2] => C:\Program Files\BitNami WAPPStack\php\PEAR\symfony/helper
      )


      As you can see, the required helper plugin dir doesn't get loaded. This seems to be the real problem.

      I already tried to google how to manually add helper directories but with no success. Can you give any advice?

    • 06/04/10 10:28am

      José Antonio says:

      Hello Christine Q.

      At this moment, I think that you problems should be in the plugin's instalation. Maybe for installing from svn or any other reason. Please, try to install the plugins from .tar.gz compress files and then make a short degug, to see the behavior of yours plugins.

      In sfProjectConfiguration class, find the getPluginSubPaths($subPath = '') function, around the line #418. And put this code here:


      //File in %symfony_lib%/config/sfProjectConfiguration.class.php
      public function getPluginSubPaths($subPath = '')
      {
      if (array_key_exists($subPath, $this->pluginPaths))
      {
      print_r($this->pluginPaths[$subPath]);exit; // 01
      return $this->pluginPaths[$subPath];
      }
      $this->pluginPaths[$subPath] = array();
      $pluginPaths = $this->getPluginPaths();
      print_r($pluginPaths); // 02
      foreach ($pluginPaths as $pluginPath)
      {
      if (is_dir($pluginPath.$subPath))
      {
      $this->pluginPaths[$subPath][] = $pluginPath.$subPath;
      }
      }
      print_r($pluginPath.$subPath);exit; // 03
      return $this->pluginPaths[$subPath];
      }


      Inspects the result, you should obtain in 02 the paths of all the installed plugins. In 03 the paths to the plgin's helpers directories. And 01 should not be printed.

      If this are Ok, then must search other posible solutions.

      Important: All this changes should be deleted at the end of the "degub".
      Regards.

    • 06/04/10 10:31am

      José Antonio says:

      Sorry, the las line code should are:


      public function getPluginSubPaths($subPath = '')
      [ ... ]
      print_r($this->pluginPaths[$subPath]);exit; // 03
      return $this->pluginPaths[$subPath];
      }


      Regardas.

    • 06/04/10 11:14am

      Christine Q. says:

      I installed the plugin from tgz-archive and did the debug as you instructed. Here is the result:

      Array
      (
      [0] => C:/Program Files/BitNami WAPPStack/php/PEAR/symfony/plugins/sfDoctrinePlugin
      [1] => C:/svn/kassa/plugins/sfDoctrineGuardPlugin
      [2] => C:/svn/kassa/plugins/sfFormExtraPlugin
      [3] => C:/svn/kassa/plugins/sfFormI18nNumberPlugin
      )

      Array
      (
      )


      So looks like the plugin path isn't found at all? And neither any helper directories? That's very strange, because when I run the command symfony plugin:list I get it listed:

      C:\path>symfony plugin:list
      Installed plugins:
      sfJqueryTreeDoctrineManagerPlugin 1.2.4-stable # pear.symfony-project.com (symfony)
      symfony 1.4.4-stable # pear.symfony-project.com (symfony)
      sfDoctrineGuardPlugin 4.0.1-stable # plugins.symfony-project.org (symfony-plugins)
      sfFormExtraPlugin 1.1.1-stable # plugins.symfony-project.org (symfony-plugins)

    • 06/04/10 11:41am

      José Antonio says:

      Sorry for being so persistent, but are you sure that the plugin directory's name is "sfJqueryTreeDoctrineManagerPlugin" (without anything else like version number or another thing) and this is the same name of you have in you ProjectConfiguration in the setup function?.
      Because Symfony load the plugins automatically looking for in the plugins folder and load all the folders than finish its name in *Plugin, then match this with the enables plugins on the project function setup().

      Maybe any name problem cause this issue.
      Regards

    • 06/04/10 1:13pm

      Christine Q. says:

      I double checked the both file names and they were exactly the same.

      It is useful information that Symfony loads the plugins automatically looking for in the plugins folder. Do you know whether it can manually adjusted?

    • 06/04/10 4:00pm

      José Antonio says:

      If you look for the function getAllPluginPaths() in the sfProjectConfiguration class, u can see like the plugins path are added to the array with address.
      This function must not fail, maybe u can do some alternative solution, but the real cause still are a mistery.

    • 06/04/10 4:12pm

      José Antonio says:

      Try a manual plugin load of this way. Put this code at the end (but inside it)
      of the class ProjectConfiguration of your project in config folder:


      <?php

      require_once '...\lib/autoload/sfCoreAutoload.class.php';
      sfCoreAutoload::register();

      class ProjectConfiguration extends sfProjectConfiguration
      {

      //... Other code...

      public function getAllPluginPaths(){
      $pluginPaths = parent::getAllPluginPaths();
      if(!isset($pluginPaths['sfJqueryTreeDoctrineManagerPlugin'])){
      $pluginPaths['sfJqueryTreeDoctrineManagerPlugin'] = sfConfig::get('sf_plugins_dir').'/sfJqueryTreeDoctrineManagerPlugin';
      }
      return $pluginPaths;
      }
      }


      This should load your plugin, at least still you find the real issue.
      Regards.

  • avatar
    Last edited:
    06/03/10
    11:56am
    Juan Guillermo García says:

    Try installing plugin version 1.2.2 which is compatible with sf1.4 also. I tried in windows and it works fine except for re-creating "category" class (model structure) when I call get_nested_set_manager helper function. Maybe is a version Issue. Normally when you autoload plugin at bootstrap application procedure it uses <plugin_folder>/helper root to load plugin helpers.

    • 06/03/10 12:30pm

      Christine Q. says:

      Thank you for your suggestions. I already came home from work and I don't have the installation available here at home. I'll get back to work in 13.5 hours from now, so I'll try your suggestions then and let you know.

This question has expired.





Current status of this question: Completed