Steve Sonius

Symfony Web Developer :: DJ :: Photographer :: Sydney Australia

March 8, 2012
by sonius
0 comments

Podcast – Slowmotion 2012-03-08

 

DOWNLOAD 154mg

 

  1. The National Bank_Home_Diskjokke Remix
  2. Kompakt_Mugwump_Losing Game_Original Mix
  3. 01_Microscope Contents
  4. Relish Records-Headman_Dieter Meier-Gimme-Kangos Autostrada Dei Laghi Mix
  5. Tirk_The Love Supreme_Waiting For The Love feat Benjamin James Smith_Mushrooms Project Remix
  6. Ghostly International_Matthew Dear_Little People Black City_Original Mix
  7. Drumpoet Community-Hunee-Took My Love-Original Mix
  8. Paper Recordings_Crazy Penis_A Little Something_PBR Streetgang edit
  9. Compost_Yannah_Eddy_Not What You Do feat Ras Tweed_Yosa feat Shu Okuyma Remix
  10. Rotters Golf Club_Andrew Weatherall_Brother Johnstons Travelling Disco Consultancy_Original Mix

February 23, 2012
by sonius
0 comments

wsdl2php plugin for symfony1.0 to symfony1.4

I needed something that would convert WSDL to useable php classes so I sould consume web services.

I had found this pear package called wsdl2php and modified the class to work as a symfony plugin.

You can download the plugin here

How to use.

  1. Unzip the folder, wsdl2phpPlugin, into your projects plugin dir
  2. Depending on your version of symfony you may ned to activate the plugin by adding
    $this->enablePlugins('wsdl2phpPlugin');

    to your ProjectConfiguration.class.php file

  3. In your action or static class simpily call the convert function, for example:
     wsdl2php::convert('http://www.webservicex.net/CurrencyConvertor.asmx?WSDL');
  4. The new class will be written to the projects main lib dir:
    eg: CurrencyConvertor.class.php
  5. Add any custom functionality in mySoapClient.class.php
  6. clear cache and your ready to go.

this is how this particular example is used:

 

$ConversionRate = new ConversionRate();
$ConversionRate->FromCurrency = Currency::USD;
$ConversionRate->ToCurrency = Currency::AUD;

$CurrencyConvertor = new CurrencyConvertor();

$ConversionRateResponse = $CurrencyConvertor->ConversionRate($ConversionRate);

var_dump($ConversionRateResponse);
exit;

 

 

 

 

 

 

 

 

February 17, 2012
by sonius
0 comments

how to build schema and keep I18n attributes in the yml file using propel and symfony 1.4

I had created I18n table set and all seemed to be working well until I tried to propel:build-schema.
I had lost my attribues:

isI18N: true, i18nTable: page_i18n & isCulture: true

This is how I want my schema to looked in the beginning:

  cms:
    _attributes: { phpName: Cms, isI18N: true, i18nTable: cms_i18n }
    id:
    handle: {type: varchar, size: 50}
    created_at:
    updated_at:
  cms_i18n:
    id:      { type: integer, size:  11, foreignTable: cms, foreignReference: id,  required: true, primaryKey: true }
    culture:     { type: varchar, size:   7, required: true, primaryKey: true, isCulture: true }
    content: { phpName: Content, type: LONGVARCHAR, required: true }

 

Basically how the build-schema work flow works like this

  1. Execute symfony propel: build-schema
  2. The sfPropelBuildSchemaTask script will create an schema.xml file from the database
  3. Then sfPropelBuildSchemaTask will create a schema.yml from the newly created schema.xml before deleting it

The way to fix this problem is to modify the schema.xml before it transformed into the schema.yml

This is how I fixed the problem.

  1. You need to find and modify the sfPropelBuildSchemaTask.class.php file
  2. Find:  protected function reverseDatabase()
  3. You will see where they define the yml and the xml path
            $xmlSchemaPath = sfConfig::get('sf_config_dir') . '/' . $name . '.xml';
            $ymlSchemaPath = sfConfig::get('sf_config_dir') . '/' . $name . '.yml';
  4. below this you should find an if block. There is no use modifying the xml if it doest exists
    if (file_exists($xmlSchemaPath)) {
  5. Immediately at the start of the ‘if’ block added this code, you may need to modify to fit your situation…
                $I18ntables = array();
                $schema = file_get_contents($xmlSchemaPath);
    
                $xml = simplexml_load_file($xmlSchemaPath);
    
                //iterate once to get all i18n tables
                foreach ($xml->table as $table) {
                    foreach ($table->attributes() as $attributeskey0 => $attributesvalue1) {
                        if ($attributeskey0 == 'name') {
                            if (preg_match("/_i18n/", $attributesvalue1)) {
                                $I18ntables[] = str_replace('_i18n', '', $attributesvalue1);
                            }
                        }
                    }
                }
                 //iterate again because we dont know the order of the tables
                 //grab the sister tables and add the new attributes
                foreach ($xml->table as $table) {
                    foreach ($table->attributes() as $attributeskey0 => $attributesvalue1) {
                        if ($attributeskey0 == 'name') {
                            if (in_array($attributesvalue1, $I18ntables)) {
                                $table->addAttribute('isI18N', "true");
                                $table->addAttribute('i18nTable', strtolower($attributesvalue1 . '_i18n'));
                            }
                            //as we are scrolling through the tables again, grab the i18n table
                            //find the column called 'culture' and add a new attribut to that
                            if (preg_match("/_i18n/", $attributesvalue1)) {
    
                                foreach ($table->children() as $columnkey0 => $columnvalue1) {
                                    if ($columnkey0 == 'column') {
                                        foreach ($columnvalue1->attributes() as $collAttrKey0 => $collAttrValue1) {
                                            if ($collAttrKey0 == 'name') {
                                                if ($collAttrValue1 == 'culture') {
    
                                                    $columnvalue1->addAttribute('isCulture', 'true');
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                //the schema has changed now so assign it here
                $schema = $xml->asXML();

 

 

There are a couple of rules you need to know to use my code

  • the 2 I18N tables must be named the same , except for the ‘_i18n’ appendment of course
  • The column where you set the culture must be named ‘culture’

 

 

 

 

cover

April 23, 2011
by sonius
0 comments

Podcast – mr sonius – easter 2011

1 Laurie Anderson – White Lily
2 Dubmission Records_Third Ear Audio_Intro_Original Mix
3 Sub Rosa_Bill Laswell_First Reading_Original Mix
4 Dig Deeper_Danny Howells_Flight Home_Original Mix
5 Sub Rosa_Bill Laswell_Assassiations 2_Original Mix
6 Grace Jones – The Crossing (Ooh The Action …)
7 Sub Rosa_Bill Laswell_Pilgrimage To Cairo_Original Mix
8 Dubmission Records_Third Ear Audio_Ethereality_Original Mix
9 Bpitch Control_Ellen Allien_Sun The Rain_Tim Hecker Remix
10 Sub Rosa_Bill Laswell_Slogans_Original Mix
11 Rong Music_Woolfy_The Warehouse_Project Sandro Remix
12 Sub Rosa_Bill Laswell_The Lord Of The Ressurection_Original Mix
13 Grace Jones – Frog And The Prince
14 Drumcode_Alan Fitzpatrick_Sub Dubbed_Original Mix
15 Sub Rosa_Bill Laswell_Morning High_Original Mix
16 inFine Music_Agoria_Kiss My Soul feat Kid A_Original Mix
17 Sub Rosa_Bill Laswell_The Western Lands_Original Mix

DOWNLOAD

cover

March 20, 2011
by sonius
0 comments

Podcast – mr Sonius’ – Lucid Dreams

 

DOWNLOAD

 

Lucid Dreams – Health Warning
Spacewalker
Lucid Dreams – Prelucid Dreams
david holmes- rodney yates
Mission At Hand
Lucid Dreams – Dream Control & Erotic Possibilities
Heavy Loaded Head
Crooklyn Dub Outernational Presents – Bill Laswell – Finite State Machine Dub
Jon Spencer Blues Explosion – T.A.T.B. (For The Saints & Sinners Remix)
Lucid Dreams – Out-Of-The-Body Experiences
Stella Polaris Music-James Holden-A Break in The Coulds-Original Mix
Four Tet – Sleep- Eat Food- Have Visions
Lucid Dreams – Lucidity
Rong Music_Mudd_Speilplatz_Quiet Village Remix
Lucid Dreams – Achieving Lucidity
Underworld – push downstairs
Burial Mix_Rhythm Sound_Dem Never Know feat Jah Cotton_Sleeparchive Remix
Lucid Dreams – False Awakenings

IMG_4884

January 13, 2011
by sonius
1 Comment

using url_for in the action in symfony 1.0

I have tried to generate an absolute url from ‘module/action’ in another action in the same way urls are generated in the view.
the trick here is to include the ‘Url’ helper in my action then adding the line..

sfLoader::loadHelpers(‘Url’);

then:
$url = url_for(‘my_module/my_action’, ‘absolute=true’);

Just Because Cover

January 4, 2011
by sonius
0 comments

Podcast – Just Because 2011 01 04

DOWNLOAD

    Secret Track #1
    big 200 track 4
    The Phenomenal Handclap Band – Give it a Rest
    sound experience- devil with a bust
    Prince & The New Power Generation – Jughead
    Gommagang Start 1 – Its Rough
    Arcadion – Ghost Feeder
    Emperor Machine – 103
    Lipservice_Chicken Lips_Ron Silver_Big 200 Version
    Broadcasting – Track 12
    Ghostly International_Matthew Dear_Little People Black City_Original Mix
    Electrik Soul Recordings_Funk DVoid_Pedro Galante_Safado_Paul Woolfords Space Funk Remix
    ILabel_James Yuill_This Sweet Love_Prins Thomas Sneaky Edit
    Rush Hour_House Of Jezebel_Love Happiness_Vocal Mix