We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

issue with 'Saving a record and its related records in a has-many relation'

Code:

$album          = new Albums();
$album->name    = 'The One';
$album->artist  = $artist;

$songs = array();

// Create a first song
$songs[0]           = new Songs();
$songs[0]->name     = 'Star Guitar';
$songs[0]->duration = '5:54';

// Create a second song
$songs[1]           = new Songs();
$songs[1]->name     = 'Last Days';
$songs[1]->duration = '4:29';

// Assign the songs array
$album->songs = $songs;

// Save the album + its songs
$album->save();
  • The above example works for x64/VC9/TS/PHP5.4.12 (Winodws7+WAMP)
  • However this breaks for x86/VC9/NTS/PHP5.4.42(Windows +IIS8)

I tried connecting WAMP to remote MySQL and the above code works fine.

What do you mean by "this breaks"? Are you getting an exception?

Strange enough! there is no error. same piece of code works on my local wamp connected to remote DB; but breaks when run on production IIS connected to same DB

breaks as in - it does not update album, nor does it insert songs

I will need some attention to this thread. Since this breaks my production code and not dev code, I need technical advice quick. Can someone give me remote help on this. The only other option is to change the complete code, which is bad.