programguru Posted March 9, 2009 Share Posted March 9, 2009 Can anyone see an issue with this causing the parse error. Am I losing my mind!! Parse error: syntax error, unexpected ',' in D:\mydirectory\product.php on line 5 <?php class Product extends AppModel { var $name = 'Product'; var $belongsTo = array('Dealer' => array('className' => 'Dealer', 'conditions'=>, 'order'=>, 'foreignKey' => 'dealer_id')); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/148563-parse-error-syntax-error-unexpected-in-dir-oop/ Share on other sites More sharing options...
.josh Posted March 9, 2009 Share Posted March 9, 2009 not that great at OOP but I don't think you can assign values to properties. Have to do it in the constructor or a regular method that's called from the constructor or calling it manually after instantiation. Quote Link to comment https://forums.phpfreaks.com/topic/148563-parse-error-syntax-error-unexpected-in-dir-oop/#findComment-780129 Share on other sites More sharing options...
btherl Posted March 9, 2009 Share Posted March 9, 2009 You've left out the values of some array elements in the inner array. You're allowed to define constants like this as default values in classes, just not make any function calls or other tricks. Quote Link to comment https://forums.phpfreaks.com/topic/148563-parse-error-syntax-error-unexpected-in-dir-oop/#findComment-780131 Share on other sites More sharing options...
.josh Posted March 9, 2009 Share Posted March 9, 2009 right, but I thought you could only define simple, scalar values, not arrays or use other things like operators? Like, you can define it as an array declaration like so: var $blah = array(); but you can't assign any values to it. Quote Link to comment https://forums.phpfreaks.com/topic/148563-parse-error-syntax-error-unexpected-in-dir-oop/#findComment-780134 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.