I'm having some issues with dealing with indirectly associated models in cakephp. My current model setup is as follows:
Deliveries hasOne License
License belongsTo Delivery
License hasAndBelongsToMany Product (and vice-versa)
License hasAndBelongsToMany ProductOption (and vice-versa)
I'm trying to save information about ALL of these ...
I have set up the necessary Models and the web interface to view them via CakePHP.
I have a script that reads emails from a POP3 box, parses out certain information.
I'd like to use the CakePHP models I have to find existing/create new records, based on information that my email script is parsing out, and save them... essentially usi...
I have a page that I want to redirect to that requires parameters in the URL:
http://www.mysite.com/myController/myAction/param1:val1/param2:val2
I know that there is a Cake PHP redirect function for redirecting that works as follows:
$this->redirect(array("controller" => "myController",
"action" => "myAction", ...
I'm putting together a system to track customer orders. Each order will have three addresses; a Main contact address, a billing address and a shipping address. I do not want to have columns in my orders table for the three addresses, I'd like to reference them from a separate table and have some way to enumerate the entry so I can dete...
Hello,
I am just getting started with Cakephp shell and running into issues.
My cake core library is under path d:/libs/cake
My app is setup under d:/servers/htdocs/myapp
I wrote a test shell under d:/servers/htdocs/myapp/vendor/shells
class ReportShell extends Shell {
var $uses = array('Appt');
function main() {
echo $this->Ap...
i have to get data from one specific field in my database and set it into a variable (most likely this has to go into the controller), so that i can echo this on multiple pages in my webapplication.
don't know if it's necassery to say, but i make use of the cakePHP framework.
thanks in advance!
...
Hi all,
I am leaning cakePHP.
I noticed that a variable $name is declared in each Controller.
What is its purpose?
Is it referring to the name of table Sites?
<?php
class SitesController extends AppController {
var $name = 'Sites';
...
}
?>
If yes,
Can users refer to more than one table like this?
var $name = 'Sites', 'Sites2', 'Sit...
Hi all,
Say I got two Controllers like this
Table1sController, and Table2sController.
with corresponding Models:
Table1sModel, Table2sModel
In the Table1sController, I got this:
$this->Table1sModel->action();
Say I want to access some data in Table2sModel
How is it possible to do something like this in Table1sController
I have tried t...
Hi all,
In a Controller, I got this:
$this->Site1->post_id=$id;
$this->set('posts', $this->Site1->read());
And when I replaced it by this line of code:
$this->set('posts', $this->Site1->read('post_id', $id));
But the returned result is totally different.
Is there any difference between them?
Is it possible to make this ...
Hello,
I have a web application which is developed in cakePHP, but from last few week, a virus is affected to the site and its not showing any pages. even if we go to the source code, nothing is there to display.
I have checked the index.php, there is no extra entry. Can some help me to find out the solution. and, how can i prevent the...
Hi all,
I am making a simple message board with some WYSIWYP function using cakePhp 1.26.
I have googled for some hints and finally reached this URL:
http://bakery.cakephp.org/tags/view/wysiwyg
But I am not sure which one is the best out there.
...
Hi all,
I was manually creating a simple form with one input text box field like this:
<form action="/user/add" method="post">
<input type="text" name="data[user_id]" value="1">
But when I call $this->model->save($this->data) in the Controller,
nothing was saved to the Table.
Only when I used this and the data in the field was writt...
Hi,
I am using CakePHP framework to build a web application. The simplest form of my problem is this:
I have a users table and a messages table with corresponding models. Messages are sent from a user to another user. So messages table has columns from_id and to_id in it, both referencing to id of users. I am able to link Message model ...
Hi everyone,
I have changed the Configure::write('Security.salt', '############'); value in the file
config/core.php
file to a '256-bit hex key'. Is it safe or a good practice to change these lines for every different installation of cakephp application or shall I revert back to the original ?
I also changed the Configure::write...
Hi
I have a problem with find query:
$userInProjects = $this->Timesheet->RegularPost->UserInProject->find('all', array('conditions' => array('UserInProject.user_id' => $id)));
The result array:
Array
(
[0] => Array
(
[UserInProject] => Array
(
[id] => 11
[project_id] => 3
...
I have four tables
Tag=>id,tag_name
Image=>Id,Image_name
TagImage=>Id,tag_id,Image_id
ImageStudent=id,Image_id,student_id
And I want to find a record using student id and tag name. What relationship do I use?
...
I have a segment which can have many comments and each comment can have many tags. I can bind the comments to the segments using code like the below which is a function in the segment model class.
function prepareForGettingSegmentsWithComments() {
$this->bindModel(
array('hasMany' => array(
'Comment' => array(
'className...
Hi there,
I'm pretty new to CakePHP and was missing a crucial feature not generated as scaffold: filtering.
What do I have to do to provide dropdowns or multi-selects on the index pages for each field that is a (foreign) key, thereby allowing to filter the table ("OR" inside multi-select, "AND" between different multi-selects, if any)?
...
Cake handles pagination of a model with a simple $this->paginate(), but what should I use if I want to paginate a array of values?
The Scenario is like this:
$this->set('sitepages', $this->paginate());
This code in my index() returns an array like
Array
(
[0] => Array
(
[Sitepage] => Array
(
...
I have the following model
class Comment extends AppModel {
var $useTable = "comments";
var $recursive = 1;
var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'userID'
)
);
function ...