Skip to content

Latest commit

 

History

History
140 lines (88 loc) · 5.06 KB

DOCUMENTATION.md

File metadata and controls

140 lines (88 loc) · 5.06 KB

Nested Set

Using PHPPixies Nested Set requires being careful.

  1. You can only add new (not "loaded()") categories into set. For this reason I've added setIsLoaded method to the BaseModel class to be able to temporarily mark model as new. Category in turn is also derived from BaseModel .

        // $category - existing category in DB
        $category->setIsLoaded(false);
        $category->nested->prepare_append($parent);
        $category->setIsLoaded(true);
        $category->save();
  2. If you operate on many categories, always refresh them before processing, because lpos, rpos and depth fields can be obsolete. PHPixie doesn't provides this capability, so the refresh() method was added.

        // ... Do something with other categories ....
    
        $rootCategory->refresh(); // !!! Important !!!
        $rootCategory->parent = 0;
        $rootCategory->save();

AMF

Hackazon is self-contained regarding AMF. That means you just have install hackazon and just use AMF service included in it. But to develop or maintain AMF functionality you have to complete several steps.

  1. Clone https://github.com/silexlabs/amfphp-2.0 repository.

  2. Create VirtualHost (e.g. backoffice.dev) pointing to the amfphp-2.0/BackOffice as a web root.

  3. Modify class Amfphp_BackOffice_Config. Set $amfphpEntryPointPath to your local VHost for hackazon (with path) and credentials:

        //...
        public $amfphpEntryPointPath = 'http://hackazon.dev/amf';
        //...
    
        public function __construct() {
            // ...
            $this->backOfficeCredentials['admin'] = 'admin';
            // ...
        }
  4. Run backoffice.dev (or whatever you named it) in browser.

  5. In Service Browser you can test your backend methods using many connection types (JSON, Flash, etc.)

  6. When you've finished developing and testing your features, go to Client Generator and generate test client in needed format.

  7. For JS service format modify web/js/amf/services.js file with generated data (do NOT replace completely).

  8. For flash or any other format modifications are up to you.

Creating Services

Services are plain PHP classes located at /modules/amfphp/classes/AmfphpModule/Services. To use Pixie inside service just include Pixifiable trait into it.

    class CouponService
    {
        use Pixifiable;
       // ....
    }

Special plugin will automatically bind Pixie to your service.

Also, it's recommended to add PHPDoc annotations to your services and their methods, as AMFPHP reads them.

AMF Revised

AMFPHP backend is integrated in Hackazon, and accessible via URL <hackazon_url>/amf_back_office/index.php. All inconsistencies have been fixed (ZIP generating, htaccecc, etc.), so it should work OK in Hackazon. Generated files reside in $DOC_ROOT/web/amf_back_office/ClientGenerator/Generated. Access to backend is left as in previous section: admin:admin.

Prepare to Flash/Flex

  1. Download and unpack Flex SDK (>= v4.6): http://www.adobe.com/devnet/flex/flex-sdk-download.html

  2. Uninstall flash player and install its debuggable version, browser plugin and separate player: https://www.adobe.com/support/flashplayer/downloads.html#fp15

  3. Create flash/flex project in your IDE of choice, based on downloaded For example, IDEA Ultimate allows to create module inside the top-level Hackazon module.

  4. Add dependencies:

    • \subprojects\Amf\lib - all extended libs, including code generated by AMFPHP generator (its common for all widgets)
    • MX library from flex sdk: flex_sdk_4.6/frameworks/libs/mx/mx.swc
  5. Just run (or fix inconsistencies dependent on your config, and then run)

  6. By default all output files should go into /web/out/<widget_name> to be accessible via browser. It gives the opportunity to test JS to AS communication, because for local files it's denied.

  7. After building and testing you should copy swfs into /web/swf folder

Android

Prepare Environment

It's better to use some tutorial for setting up the environment for Android either from the google website, or any other. But here are the most important steps:

  1. Install and set up Android SDK in your IDE (Or use Android build for Eclipse or Android Studio)

  2. Set the path subprojects\android\hackazon as a project root.

  3. Set up the AVR virtual device for testing purposes.

  4. Add jar's from jars folder to project build paths.

  5. Create run configuration in your IDE which runs the AVR and when it's ready, installs and runs the application on virtual device.

  6. When you feel that the app is ready, you can test it on your Android device by plugging it to the PC and configuring run configuration.

  7. Just take the hackazon.apk file from \subprojects\android\hackazon\out\production\hackazon\com. Profit!

PS: To deploy the app to some kind of app store the app have to be signed. IDE helps with this task.