PHP - Moved: Relationships In Cakephp
This topic has been moved to Other Libraries and Frameworks.
http://www.phpfreaks.com/forums/index.php?topic=352357.0 Similar TutorialsThis topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=332465.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=353428.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=308958.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352519.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352167.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=353875.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=347122.0 I can create a one-to-one relationship between two tables by placing a unique constraint on the foreign key and making it NOT NULL, and make it one-to-at-most-one by removing the NOT NULL constraint. My question is what criteria should one use to determine which table holds the foreign key? For instance, I have the Car and Motor entities as shown below where one Car has one Motor, and conversely one Motor is used by one Car.
AbstractPart
Car extends AbstractPart What reasoning should one use to determine whether the Car table contain the Motor ID or should the Motor table contain the Car ID? This is a LINK to the page -> http://shoutkey.com/carriage I have a problem of separating MySQL concatenated info, yet still maintaining their relationship to other arrays in the same order. First off here is the MySQL code: Code: [Select] $query ="SELECT report,"; $query.="GROUP_CONCAT(DISTINCT docID) AS docIDs, "; $query.="GROUP_CONCAT(DISTINCT analyst) AS analysts, "; $query.="GROUP_CONCAT(DISTINCT region) AS regions, "; $query.="GROUP_CONCAT(DISTINCT country) AS countries, "; $query.="GROUP_CONCAT(DISTINCT topic) AS topics, "; $query.="GROUP_CONCAT(DISTINCT date) AS dates, "; $query.="GROUP_CONCAT(DISTINCT event) AS events, "; $query.="GROUP_CONCAT(DISTINCT link) AS links, "; $query.="GROUP_CONCAT(DISTINCT province) AS provinces "; $query.="FROM reports GROUP BY report ORDER BY dates DESC, docIDs DESC"; The most important thing is to get all attributes about each report. The thing is, each report can have as many records as it must, in order to store various types of information, like, if multiple analysts are working on the report, then each one saves their own record, but when retrieving these records MYSQL concatenates the records, to make it look to the analysts like this Report 1 --- Josh, Rebecca --- Philippines However, my problem is trying to display the reports by country... as you can see http://shoutkey.com/carriage. I have no idea about how to split up the countries, while maintaining their relationship to the $rows pulled from MySQL. I am gonna post the entire code, and let me know if anybody has any ideas. Code: [Select] $result = mysql_query($query); $numrows = mysql_affected_rows(); $current = false; while($row=mysql_fetch_assoc($result)) { $dates = $row['dates']; $analysts = $row['analysts']; $provinces = $row['provinces']; $topics = $row['topics']; $regions = $row['regions']; $countries = $row['countries']; $reports = $row['report']; $links = $row['links']; $events = $row['events']; if (!$current){ //first call echo "<h3><a href=\"#\">{$countries}</a></h3>"; //echo first call $current = $countries; echo "<div>" ;//open content div } elseif($current != $countries){ // country has changed echo "</div>"; //close previous content div echo "<h3><a href=\"#\">{$countries}</a></h3>"; //echo subsequent countries $current = $countries; echo "<div><p>" ;//open content div } echo $analysts." ----- ".$provinces." ----- ".$reports; echo "<br /><br />"; } echo "</div>"; ?> </div> I am looking to learn CakePHP are there recommendations for tutorials on CakePHP?
I hear CakePHP 3.0 being talked about like its something for the future but I also see that you can download it and there are tutorials for it out already. Is it ready for developmental use, or is it still too early for that?
I have a php file with a ton of vars that i need to access in a number of controllers. How can i simply include this file into a controller in cakephp? ~John Hey all, I'm using cakephp and it asks me a question and I'm not sure what to put in, because I don't necessarily know the consequences of what I put in: Code: [Select] Would you like to create the methods for admin routing? (y/n) [y] > y You need to enable Configu :write('Routing.admin','admin') in /app/config/core.php to use admin routing. What would you like the admin route to be? Example: www.example.com/admin/controller What would you like the admin route to be? [admin] > Thanks for response I am looking for a blog app or also a magazine type web app for CakePHP to learn from - any suggestions?
There are no opening and closing tags in the code example of the file PostsController.php in this tutorial:
http://book.cakephp....g/part-two.html
Should I always use opening and closing PHP tags throughout with CakePHP? I have been learning php and have put together a simple site to track vehicle faults and repairs, but now i am trying to transfer it to cakephp framework to make it easier to work with. My problem is that i have 4 tables,
the fault and repair
a list of vehicles
a list of symptoms
a list of fault codes.
Each repair can have 3 vehicles, 3 symptoms and 3 codes relating to it so i have lookup table to link the fault/repair id to the symptoms, code and vehicles.
i have setup basic code for the vehicle , symptom and fault code models like this:
public $hasAndBelongsToMany = array( 'Fault' => array( 'className' => 'Fault', 'joinTable' => 'Faults_vehicles', 'foreignKey' => 'vehicle_id', 'associationForeignKey' => 'fault_id' ) ); and this lets me search for any faults in the faults table with a given vehicle ID, and this works fine. My problem is how can i set it up so i can do a search for faults in the Faults table with a given vehicle ID and a given symptom ID that have a matching Fault code ID. I am very new to php and have only just started using cakephp so sorry in advance if this makes no sense at all. thanks for your time j Hi, I am having an awful time creating a composer.json file to install highchartsPHP for windows cakephp. I dont know how exactly to create a file. The examples I have for cakephp composer is for linux. I download the highchartsphp and I place it where? I have composer installed and I do what as version 3 doesnt require composer . https://github.com/g...i/HighchartsPHP I place the highcharts dir where ? where I should place files to install? How do I install this EXACTLY and does this require mean I have dir called ghunti? I really need some decent how to install as this really isnt good enough . It has been 2 days since I tried to install this highchartsPHP for cakePHP. { "require": { "ghunti/highcharts-php": "~3.0" } } Hello,
I have been using cakePHP now for a couple projects now. My next projects involves creating a web service and the entire front-end be built in angularjs.
Now, I understand how 'Form' Authentication works, and have done some research and people tell me if I have an SSL to use Basic Auth, for a web service, which is what I am using. But I am having a problem hooking both up nicely. Now with angular, I have a call for a page and send over the username and password. If the credentials are correct, the server returns back the correct data. The problem is if the credentials are wrong, I get the normal 'Basic Auth' pop up, asking me for my username and password.
My question is, instead of the server trying to re access the same page, is there a way to return json data back?
Example : I have an angular call going to 'cakerest/projects.json' -> Credentials are ok -> Data is returned, and with javascript I console.log it and see it.
2nd time I send the incorrect user and password, and the server responds back with a popup asking for credentials.
How can I get rid of that popup and just return "{Error : 'Credential problem'};
I can post code if that would help as well.
Thank you
Hello everyone. I'm relatively new to PHP, and I'm loving how CakePHP has made my life easy, and hard at the same time. I'm having trouble updating the deprecated Forum Plugin from milesj. If anyone there could help me, I'd much appreciate it. First off, deprecated views and controllers. They amaze me to no end. No matter how deep I try to trace them, it's impossible for me to find out what is wrong with it. I do have an idea, but I can't trace where I should change the codes. Second; admin roles, ACL, CRUD is not a fairly new concept to me now, but because of the deprecated codes I can't get a deeper understanding about why I can't disable new users from accessing the admin panel. Third; the Admin Plugin is good, but wouldn't detect the Forum Plugin correctly. I can't trace back where this went wrong. Also, adding new users through the admin panel doesn't hash the password. My codes are here for your viewing and mockery: http://www.mediafire...1/AsCIISite.rar I have a 3-tables |