Try adjusting your AccountUser model to explicitly specify the
AccountModule plugin relations:
class AccountUser extends AccountModuleAppModel {
...
var $hasMany = array(
'AccountLicense' => array(
'className' => 'AccountModule.AccountLicense',
'foreignKey' => 'user_id'
)
)
If using the EmailComponent works in other parts of your controller,
and the "code excerpt" you provided was just manually entered into
your original email (the first two lines would have resulted in a
syntax error as it is written) you can try adding
$this->Email->return = "Mysitename ";
befor
In the updateAll() section of the CakePHP Book (http://
book.cakephp.org/view/1031/Saving-Your-Data) has the following
information box:
The $fields array accepts SQL expressions. Literal values should be
quoted manually.
It's a bit terse, but basically it's saying that if you want to update
a fie
The options displayed in the select box is usually generated with a
Model::find('list'), which you can adjust to display a specific column
from your model (see:
http://book.cakephp.org/view/1017/Retrieving-Your-Data#find-list-1022).
If you are using CakePHP 1.3.x, you can use a virtual field compo
One of the troubleshooting steps I take whenever I have this error on
a project is to log onto the database using the same connection info
as in my database.php file. The screen shot of MySQLWorkbench
indicates a connection using 'root', which can see all the tables in
all the databases; the scree
Your model relationship should actually be:
Item belongsTo Unit
Unit hasMany Items (optional)
In the Cookbook subsection ""3.7.6.3 belongsTo" (http://
book.cakephp.org/view/1039/Associations-Linking-Models-
Together#belongsTo-1042, part of "3.7.6 Associations: Linking Models
Together"), there is
Sorry, the second link should be
http://www.php.net/manual/en/language.types.array.php#language.types.array.casting
I copied the URL from the wrong window.
On May 20, 7:02 pm, ShadowCross wrote:
> The foreach statement requires that the first argument is an array.
> In your case, $fo
The foreach statement requires that the first argument is an array.
In your case, $formdata = null, which is NOT an array; null is
different from an empty array. Your code needs to check if $formdata
is null (see: http://php.net/manual/en/function.is-null.php) and skip
the foreach loop accordingly
Did you create your Access Control Objects? See:
http://book.cakephp.org/view/1548/Creating-ACOs-Access-Control-Objects
and the subsequent page:
http://book.cakephp.org/view/1549/An-Automated-tool-for-creating-ACOs
(and http://book.cakephp.org/view/1550/Setting-up-permissions)
Basically, any acti
If you are using MySQL as your database backend, read
http://www.desilva.biz/mysql/random.html (found by Googling "mysql
random row").
If you are not using MySQL, check if your database has a similar
function.
On May 19, 5:56 am, Sarpidon wrote:
> Hi everybody.
>
> I have a companies table and
@euromark
You're absolutely right. I should avoid doing anything cerebral after
midnight when I'm exhausted but unable to sleep--the synapses didn't
fire all the way. :-D
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions si
If:
Survey hasMany SurveyUser
User hasMany SurveyUser
SurveyUser belongsTo Survey
SurveyUser belongsTo User
with ContainableBehavior (see: http://book.cakephp.org/view/1323/Containable),
you can try something like the following in your controller:
// Get list of all surveys, and any responses
This isn't a CakePHP bug. The Model::getNumRows() function returns the
number of rows returned in the last query. Since you are using the
limit clause, the number of rows in the query is less than or equal to
the limit (10 rows in your example). To get the actual number of rows
that could be retur
The Cookbook has a section on setting up the URL rewrites on IIS for
CakePHP:
http://book.cakephp.org/view/1636/URL-Rewrites-on-IIS7-Windows-hosts
On Apr 16, 9:13 am, AD7six wrote:
> On Apr 15, 6:03 pm, Brij wrote:
>
> > Hi All,
>
> > I just setup my window IIS server and I wanna install cakeph
In the CakePHP 1.3 Book, "New features in CakePHP 1.3 :: Appendices ::
The Manual :: 1.3 Collection" (http://book.cakephp.org/view/1572/New-
features-in-CakePHP-1-3), there's a subsection of the "# Library
classes" section called "App/libs" that has examples of using
App::import() to load from the
in the Model that it belongsTo (User) with the
number of related rows. You can then use the field (User.like_count)
in the 'order' option of Controller::paginate.
On Apr 1, 10:09 am, CrotchFrog wrote:
> @ShadowCross:
>
> I originally tried your example of:
>
> [code]
> $this-&
If I'm interpreting it correctly, you have a table 'likes' that has the
following fields:
user_id (unique, represents the user_id of the person who is liked)
count (number of users who indicated that they like this user_id)
so that Like belongsTo User, and conversely, User hasOne Like. Assum
When you use Caching in the Controller
(http://book.cakephp.org/view/1380/Caching-in-the-Controller), Cake bypasses
the actual code in the function.
=
>From http://book.cakephp.org/view/1381/Marking-Non-Cached-Content-in-Views
It should be noted that once an action is cached, *the controlle
My apologies. In retrospect, I think the only method in the PaginatorHelper
that I used when manually loading the helper (and not using
Controller::paginate()) was PaginatorHelper::sort().
Basically, since you are not using the Controller::paginate() function, you
pretty much either have to wr
Oops. In option 2, the line
'conditions' => array('User.id' => $user )));
should be
'conditions' => array('User.id' => $liked[$i] )));
--
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
If you want to paginate based on the primary model (in this case User,
ignoring Like for the pagination), you have two possible options:
1) Add two parameters to the Like::getMostLiked() function to control
"pagination" on the array returned, i.e.:
class Like extends AppModel {
...
The first thing I see is that your wizard() method assigns the
parameter to the "$steps" variable, but never uses $steps within the
method itself -- it passes the "$step" variable to $this->Wizard-
>process(), and you haven't defined the value of the "$step" variable.
I'm assuming you are trying
The error message mentions "stdClass::find()", which seems to indicate
that it's not using your ArosAcos model at all. I think the main part
of your problem is that in your ArosAcosController, you have:
var $name = 'aros_acos';
when it should be:
var $name = 'ArosAcos';
Cake uses the $name
In the CakePHP Book (http://book.cakephp.org/view/1039/Associations-
Linking-Models-Together), there are several sections that you should
note:
In the end of "3.7.6.5 hasAndBelongsToMany (HABTM)" (although it
applies to all relation types), the Book states:
The same binding trick can be used to e
ing controller implementing the
beforeFilter() method? Are you calling parent::beforeFilter() within
the method?
On Mar 14, 3:06 am, Carachi wrote:
> Thank you ShadowCross,
> I do some other test and I discover that if I call the function from
> URL it works and the Security::cipher
Set::combine() transforms your original array into
Array
(
[path1] => [path2]
...
)
so $combine = Set::combine($this->data,'{n}.{n}.Tree.id','{n}.
{n}.Tree.name');
would result in
Array
(
[1] => Pine,
[2] => Birch,
[24] => Cherrywood
...
)
Which is nothing like what you originally i
In your UsersController, try adding the following lines BEFORE you
execute $this->Cookie->write():
debug(Configure::read('Security.salt');
debug($this->Cookie->key);
The first line displays the default key that the CookieComponent uses
(usually defined in app/config/core.php), but the second
goluhaque:
If I'm reading your code correctly, your Post model has a validation
rule on a fieldName 'post' that must be at least one character in
length and is required (although the rule name 'minLenght' is
misspelled). However, the form defined in your view does not have an
input for this field
How the database stores the values shouldn't matter. You can always
format it in your view file using the TimeHelper, or even the php
date() function directly (possibly tailoring it to the user's
locale).
On Mar 1, 5:16 pm, theweirdone wrote:
> So you were right. The problem was the date validat
Ryan:
Per the CakePHP Book, saveAll() has two variations (http://
book.cakephp.org/view/1031/Saving-Your-Data):
"For saving multiple records of single model, $data needs to be a
numerically indexed array of records like this:"
and
"For saving a record along with its related record having a hasOn
TimG:
Verify that you have an index on parent_id column in categories table
(as well as a separate index on the id column). ContainableBehavior
usually tries to generate a LEFT JOIN with the belongsTo and the
hasOne related tables, so without the proper indexes, the database may
be resorting to a
With Policy hasMany Notification, using the find() on Policy creates a
LEFT JOIN with Notification. Since you want all notifications (with
user_id = $me) whether or not there is a Policy, the join should
either be Notification LEFT JOIN Policy or Policy RIGHT JOIN
Notification. (For more explanat
tions' => array(
> 'Notification.user_id' => $me,
> 'OR' => array(
> 'Policy.status' => 0,
> 'Policy.status IS NULL')),
>
> Thanks
>
>
>
> -Original Message-
#x27; => array(
'Notification.user_id' => $me,
'IFNULL(Policy.status, 1)' => 1
)
On Feb 16, 8:47 pm, ShadowCross wrote:
> Try:
>
> 'conditions' => array(
> 'OR' => array(
> 'Policy.status' => 1,
>
Try:
'conditions' => array(
'OR' => array(
'Policy.status' => 1,
'Policy.status IS NULL'
)
)
or for MySQL:
'conditions' => array(
'IFNULL(Policy.status, 1)' => 1
)
On Feb 16, 10:54 am, "Krissy Masters"
wrote:
> Sorry I did not explain the Notifications better.
> If a Notificatio
Hi Ryan:
With your proposed design, you can control the Content "isOnlyOneOf"
using the beforeSave(), but consider the following:
1) What if, in the future, you want to create another specialized
Content class? That means you will need to not only create a new
table, but also add another column
ase name plus
> table and not just the short model table name? Never did that before. Is a
> ticket for a problem only? Feature suggestion?
>
> Thanks all the same.
>
> K
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegro
Have you tried moving the line
parent::beforeFilter()
below the lines where you set the AuthComponent variables (or possibly
removing it alltogether)? It may be that the AuthComponent's
loginAction is being "processed" in the AppController's
beforeFilter(), before the userScope is being set in
Have you considered something like:
Bookmark
hasOne Content
Message
hasOne Content
Post
hasOne Content
Content
belongsTo Bookmark
foreignKey => 'model_id'
conditions 'model' => 'Bookmark'
belongsTo Message
foreignKey => 'model_id'
conditions 'model' => 'Message'
belong
In your offers_controller.php, are you using $this->Offer->save() or
$this->Offer->saveAll() ? (See:
http://book.cakephp.org/view/1031/Saving-Your-Data
to review the explanation of each).
On Feb 10, 10:58 am, "John H." wrote:
> Hi all,
>
> I am working on a project for a client and had a progra
It works for me:
class Country extends AppModel {
var $useDbConfig = 'iso';
}
class Address extends AppModel {
var $useDbConfig = 'default';
var $belongsTo = array(
'Country' => array(
'className' => 'Country'
)
);
}
Whenever I access the Address tab
See my reply to your other post on this same issue ("HABTM w/ Multiple
Select type Field and saveAll() on multiple records.")
On Feb 9, 9:21 pm, OldWest wrote:
> Does anyone know if this is possible within the CakePHP framework?
>
> http://stackoverflow.com/questions/4950487/cakephp-multiple-entr
I just saw your other post on this same subject.
per the CakePHP Book (http://book.cakephp.org/view/1031/Saving-Your-
Data):
saveAll(array $data = null, array $options = array())
Used to save (a) multiple individual records for a single model or
(b) this record, as well as all associated rec
See: http://book.cakephp.org/view/1069/cacheQueries
On Feb 9, 4:41 pm, Ryan Schmidt wrote:
> Consider that I have a model Foo that has methods doSomething and
> doAnotherThing that do something useful. These methods need data from the
> database, so they use $this->find. But they also need to c
You can try adding it to your app_model:
config/core.php:
Configure::write('BRAND_NEW', '-24 hours');
Configure::write('NEW', '-48 hours');
Configure::write('RECENTLY_NEW', '-96 hours');
app_model.php:
function rowNewness($data = null) {
if (!$data) {
$data = $this->data;
}
f
implement to greatest Social site on the Net... LoLo But,
> that just me... Please help me if you can. You can grab the testing
> URL from my profile,... I don't wanna post it here, not to sound like
> a spam... And if you signup on my site, I will meet you there,... and
&
Have you tried just using:
echo $this->Form->input('Zip');
http://book.cakephp.org/view/1390/Automagic-Form-Elements specifically
provides an example for creating a hasAndBelongsToMany select (just
search for the text "hasAndBelongsToMany" on that page).
On Feb 9, 2:10 pm, OldWest wrote:
> I wa
How about in the afterFind() method of the Game model?
On Feb 6, 5:57 pm, Danny W wrote:
> Hi Everyone,
>
> This problem is kind of complicated but I'll try to explain it as best
> I can.
>
> I have a model/database table: Games
> The games table has a `home_team_id` field and a `visiting_team_id
Greg:
The problem is the following code in your tabs class:
$this->path = 'C:/xampp/htdocs/ezShoot_v5/app/plugins/
apphp_tabs/webroot/';
if(file_exists($this->path."styles/common.css"))
echo "";
$this->path refers to a local path that php (running on your
webserver) can
mousa777:
I'm assuming that the missing end tags John refers to is in the "//
all the thing that to be displayed here //" comment, as well as the
tag(s) that actually use the $class variable.
Look at the part of your code:
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
Chris:
After reviewing your code snippets, here are some of my
recommendations:
1) Instead of defining your classes as:
Video
- belongsTo VideoCategory
- belongsTo User
- hasMany VideoComment
- hasMany VideoFavorite
VideoFavorite
- belongsTo User
- belongsTo Video
User
- hasMany Video
- hasMan
Chris:
I find it extremely difficult to make any recommendations without
additional details, particularly:
- the associations you defined in your User and Video models
- the code in the controller/action that will be used to retrieve the
information from the model(s)
- the code (or snippet) of the
What's preventing you from using the EmailComponent inside another
component? Have you tried following the example on
http://book.cakephp.org/view/999/Using-other-Components-in-your-Component
?
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new
Ernesto:
Some things to try:
For your first example: ignore some validation rules if the user has
"authorization X".
- validate the data from the controller, using the $options parameter
to specify which subset of the validation rules to apply. There is a
(albeit simplistic) example in the Cookb
Dave:
Are you using the "with" key when you define your HABTM associations
in both sides of the model? The "with" key forces CakePHP to use a
specific model for the joinTable instead of autocreating one
Example:
category.php:
class Category extends AppModel {
var $useDbConfig = 'resour
I'm not seeing anything in your code that would produce a confirmation
request. Your delete link in your view is
echo $html->link('Delete',array('action'=>'delete',
$user['User']['id']),array('class'=>'confirm_delete'));
Are you attaching JS code to the click event of DOM objects with the
'
The line
RewriteCond %{SERVER_PORT} !^80$
seems to indicate that your RewriteRule's are only applied if the
incoming request is NOT coming in from port 80 (port 80 is usually the
http:// port, while port 443 is usually the https:// port). The "!"
negates the pattern, so I think you will get in
Assuming
ModelA hasMany ModelB
ModelB includes a date column called 'date'
you could try:
$this->ModelA->bindModel(array(
'hasOne' => array(
'MaxDateModelB' => array(
'className' => 'ModelB',
'foreign_key => 'model_a_id',
'conditions' => 'MaxDateMo
Chris, forgive me if I'm not reading your original request properly,
because I seem to be missing something...
In CakePHP, the view.ctp is usually used to display the contents of an
EXISTING record, so having the option to "Create Resume" using this
view doesn't make sense to me. In fact, if you
59 matches
Mail list logo