Quantcast

Problem associating models with linux (working fine on windows using xampp)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Problem associating models with linux (working fine on windows using xampp)

chris7548
Hello,

I have developed an cakephp application on an xampp installed on a
windows 7 ios. On this configuration everything works fine. But when i
try to run the application on a linux ios the model associations
aren't interpreted anymore:

Example:

I've got a table user that has got a suffix_id for identifiying the
email_suffix of the user. The user data is accessed by the
EvaluationsController via the Evaluation model.

class User extends AppModel {
        public $primaryKey = 'id';
        public $name = 'User';
        public $belongsTo = 'Suffix';
        public $hasMany = array('GroupMember', 'Result', 'Supervisor');
        public $useTable = 'users';
}

class Suffix extends AppModel {
        public $primaryKey = 'id';
        public $name = 'Suffix';
        public $hasMany = 'User';
        public $useTable = 'suffixes';
}

class Evaluation extends AppModel {
        public $useTable = false;
        public $hasOne = array('Exercise', 'GroupMember', 'Group', 'Result',
'Supervisor', 'User');
}

class EvaluationsController extends AppController {

public $helpers = array('Html', 'Form');

        public function index() {
                ...
            $users = $this->Evaluation->User->findAllById(6);
            ...
        }
}


The generated SQL-Statement on linux is:

SELECT `User`.`id`, `User`.`surname`, `User`.`forename`,
`User`.`email_prefix`, `User`.`suffix_id`, `User`.`valid` FROM `This-
is-GRADE`.`users` AS `User` WHERE `User`.`id` = 6


The right SQL-Statement (generated on windows) is:

SELECT `User`.`id`, `User`.`surname`, `User`.`forename`,
`User`.`email_prefix`, `User`.`suffix_id`, `User`.`valid`,
`Suffix`.`id`, `Suffix`.`suffix` FROM `This-is-GRADE`.`users` AS
`User` LEFT JOIN `This-is-GRADE`.`suffixes` AS `Suffix` ON
(`User`.`suffix_id` = `Suffix`.`id`) WHERE `User`.`id` = 6


Anyone has got an idea why this code is just working on windows and
linux don't understand it correctly?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problem associating models with linux (working fine on windows using xampp)

Flo ßbau
Hi, as a member of the team that discovered the problem above, I'm happy to tell you that the problem was caused by different Apache settings on the Windows and Linux system.

In some models we used SHORT OPENING PHP TAGS while these tags were not enabled in the Apache config on the Linux box. After changing the server config the models have been interpreted correctly. Thanks a lot to Ceeram from the Freenode-IRC-Channel #cakephp for giving this hint!

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problem associating models with linux (working fine on windows using xampp)

Nelson Guaman
In reply to this post by chris7548
How you solve the problem?¡

El viernes, 15 de junio de 2012 09:51:58 UTC-4, chris7548 escribió:
Hello,

I have developed an cakephp application on an xampp installed on a
windows 7 ios. On this configuration everything works fine. But when i
try to run the application on a linux ios the model associations
aren't interpreted anymore:

Example:

I've got a table user that has got a suffix_id for identifiying the
email_suffix of the user. The user data is accessed by the
EvaluationsController via the Evaluation model.

class User extends AppModel {
        public $primaryKey = 'id';
        public $name = 'User';
        public $belongsTo = 'Suffix';
        public $hasMany = array('GroupMember', 'Result', 'Supervisor');
        public $useTable = 'users';
}

class Suffix extends AppModel {
        public $primaryKey = 'id';
        public $name = 'Suffix';
        public $hasMany = 'User';
        public $useTable = 'suffixes';
}

class Evaluation extends AppModel {
        public $useTable = false;
        public $hasOne = array('Exercise', 'GroupMember', 'Group', 'Result',
'Supervisor', 'User');
}

class EvaluationsController extends AppController {

public $helpers = array('Html', 'Form');

        public function index() {
                ...
                    $users = $this->Evaluation->User->findAllById(6);
                    ...
        }
}


The generated SQL-Statement on linux is:

SELECT `User`.`id`, `User`.`surname`, `User`.`forename`,
`User`.`email_prefix`, `User`.`suffix_id`, `User`.`valid` FROM `This-
is-GRADE`.`users` AS `User` WHERE `User`.`id` = 6


The right SQL-Statement (generated on windows) is:

SELECT `User`.`id`, `User`.`surname`, `User`.`forename`,
`User`.`email_prefix`, `User`.`suffix_id`, `User`.`valid`,
`Suffix`.`id`, `Suffix`.`suffix` FROM `This-is-GRADE`.`users` AS
`User` LEFT JOIN `This-is-GRADE`.`suffixes` AS `Suffix` ON
(`User`.`suffix_id` = `Suffix`.`id`) WHERE `User`.`id` = 6


Anyone has got an idea why this code is just working on windows and
linux don't understand it correctly?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problem associating models with linux (working fine on windows using xampp)

Daniel Baird
I think you're asking how to enable PHP short tags..

http://stackoverflow.com/questions/2185320/how-to-enable-php-short-tags 



On Sat, Aug 4, 2012 at 2:58 AM, Nelson Guaman <[hidden email]> wrote:
How you solve the problem?¡

El viernes, 15 de junio de 2012 09:51:58 UTC-4, chris7548 escribió:
Hello,

I have developed an cakephp application on an xampp installed on a
windows 7 ios. On this configuration everything works fine. But when i
try to run the application on a linux ios the model associations
aren't interpreted anymore:

Example:

I've got a table user that has got a suffix_id for identifiying the
email_suffix of the user. The user data is accessed by the
EvaluationsController via the Evaluation model.

class User extends AppModel {
        public $primaryKey = 'id';
        public $name = 'User';
        public $belongsTo = 'Suffix';
        public $hasMany = array('GroupMember', 'Result', 'Supervisor');
        public $useTable = 'users';
}

class Suffix extends AppModel {
        public $primaryKey = 'id';
        public $name = 'Suffix';
        public $hasMany = 'User';
        public $useTable = 'suffixes';
}

class Evaluation extends AppModel {
        public $useTable = false;
        public $hasOne = array('Exercise', 'GroupMember', 'Group', 'Result',
'Supervisor', 'User');
}

class EvaluationsController extends AppController {

public $helpers = array('Html', 'Form');

        public function index() {
                ...
                    $users = $this->Evaluation->User->findAllById(6);
                    ...
        }
}


The generated SQL-Statement on linux is:

SELECT `User`.`id`, `User`.`surname`, `User`.`forename`,
`User`.`email_prefix`, `User`.`suffix_id`, `User`.`valid` FROM `This-
is-GRADE`.`users` AS `User` WHERE `User`.`id` = 6


The right SQL-Statement (generated on windows) is:

SELECT `User`.`id`, `User`.`surname`, `User`.`forename`,
`User`.`email_prefix`, `User`.`suffix_id`, `User`.`valid`,
`Suffix`.`id`, `Suffix`.`suffix` FROM `This-is-GRADE`.`users` AS
`User` LEFT JOIN `This-is-GRADE`.`suffixes` AS `Suffix` ON
(`User`.`suffix_id` = `Suffix`.`id`) WHERE `User`.`id` = 6


Anyone has got an idea why this code is just working on windows and
linux don't understand it correctly?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php



--
Daniel Baird
I've tried going to the XHTML <bar /> a few times, but it's always closed.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Loading...