Some “Why Won’t Solar Work” Tips

With more and more people installing and using Solar all the time, theres some questions that get asked quite a bit. I wanted to help with some of those questions by providing some simple answers here. Here we go…

  • Tip #1 – Be sure that you have your App directory correctly set in the configuration file. If you don’t add it to your front controller Classes setting, Solar has no idea where to find it.
  • Tip #2 – Class names on the controllers are important! Be sure it follows the directory tree like Project_App_Controller. Also be sure you’re extending the right thing. I usually use a Base controller/setup to provide an overarching “global” place to put things (like a layout) and extend that, so it’s usually “extends Project_App_Base”
  • Tip #3 – You can change the values that the Solar_Form login functionality uses to trigger the automagic login process by setting it in the adapter for your authentication object (like a Solar_Auth_Adapter_Sql) via the process_login and process_logout values.
  • Tip #4 – Be sure to include everything you need to get to “magically” through Solar in the set_include_path in the front controller. For example, you can add in another directory with external libraries so that in your application, you can just call it and let the __autoload handle it.
  • Tip #5 – You might get some complaints from Solar about not having a “sql” object it can work with. I good way to handle this is to check in your _setup function of your controllers to see if there’s one registered. If not, make one with a factory call and register it for the framework’s use: Solar_Registry::set(‘sql’, Solar::factory(‘Solar_Sql’));

Category: PHP, Solar | Tags: 5 comments »

5 Responses to “Some “Why Won’t Solar Work” Tips”

  1. PHP5-Framework Solar steuert in Richtung Version 1.0 - Developer's Guide

    [...] die erste Gehversuche mit Solar unternehmen, sei auch dieser Blogeintrag von Chris Cornutt ans Herz gelegt. In diesem beschreibt er einige Stolpersteine bei der Verwendung von Solar und wie [...]

  2. rodrigo moraes

    Hey Chris,
    Nice tips! :)

    One shortcut: to register objects, it is not necessary to “factory” them. They will be automatically instantiated the first time you request the registry key, so this would be enough to register Solar_Sql:

    Solar_Registry::set(’sql’, ’Solar_Sql’);

  3. rvdavid

    Good post, I’ve just downloaded the framework and currently testing it out. Ran into some issues and found your site through google. Although the issue isn’t covered here (actually, I’ve managed to sort it out in my head during this moment of procrastination), you’ve noted a couple of things I’ll keep in mind.

    Thanks.

  4. enygma

    @rdavid: glad you found it! :) What was the issue that you had in your code? I’d be happy to add it to the list so it might help out others…

  5. rvdavid

    I thought it was just one of those simple but obscure pathing issues, but upon closer inspection, it is related to tip#1 :)


Leave a Reply



Back to top