Re: Associated models using wrong primary key

2011-10-08 Thread ShadowCross
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'     ) )

Re: CAKEPHP Email component not working in live server.. how to get the error response why that mail is not going

2011-08-22 Thread ShadowCross
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

Re: problem in updateAll

2011-08-22 Thread ShadowCross
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

Re: Form helper input select box customization

2011-05-30 Thread ShadowCross
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

Re: Error: Database table acos for model Aco was not found.

2011-05-30 Thread ShadowCross
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

Re: One-way relationship

2011-05-30 Thread ShadowCross
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

Re: Invalid argument supplied for foreach() [APP\app_controller.php, line 58]

2011-05-20 Thread ShadowCross
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

Re: Invalid argument supplied for foreach() [APP\app_controller.php, line 58]

2011-05-20 Thread ShadowCross
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

Re: Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check.

2011-05-20 Thread ShadowCross
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

Re: Random query question

2011-05-19 Thread ShadowCross
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

Re: Only show data which isn't in the other table. (complex).

2011-05-09 Thread ShadowCross
@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

Re: Only show data which isn't in the other table. (complex).

2011-05-06 Thread ShadowCross
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

Re: Issue with getNumRows

2011-05-02 Thread ShadowCross
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

Re: How can I run cakephp in IIS server (windows)

2011-04-16 Thread ShadowCross
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

Re: creating a non-component for my controller

2011-04-06 Thread ShadowCross
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

Re: Paginate pre-ordered list

2011-04-02 Thread ShadowCross
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-&

Re: Paginate pre-ordered list

2011-03-31 Thread ShadowCross
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

Re: View caching - problems with different user roles

2011-03-30 Thread ShadowCross
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

Re: Paginate pre-ordered list

2011-03-30 Thread ShadowCross
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

Re: Paginate pre-ordered list

2011-03-30 Thread ShadowCross
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

Re: Paginate pre-ordered list

2011-03-30 Thread ShadowCross
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 { ...

Re: cakephp-wizard Redirect Loop

2011-03-20 Thread ShadowCross
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

Re: Query to select multiple table in cakephp

2011-03-20 Thread ShadowCross
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

Re: Pagination with recursion while using loadModel

2011-03-20 Thread ShadowCross
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

Re: Error Security::cipher()

2011-03-16 Thread ShadowCross
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

Re: CakePHP set::combine(). Need a numeric array transformed into an associative array.

2011-03-12 Thread ShadowCross
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

Re: Error Security::cipher()

2011-03-11 Thread ShadowCross
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

Re: Problems in saving form data to database

2011-03-11 Thread ShadowCross
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

Re: Can't Save to DB

2011-03-01 Thread ShadowCross
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

Re: Can't Save to DB

2011-02-28 Thread ShadowCross
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

Re: Containable Query Slow - Am I doing it wrong?

2011-02-28 Thread ShadowCross
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

Re: Joins Conditions Contain Question

2011-02-16 Thread ShadowCross
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

Re: Joins Conditions Contain Question

2011-02-16 Thread ShadowCross
tions' => array( >         'Notification.user_id' => $me, >         'OR' => array( >                 'Policy.status' => 0, >                 'Policy.status IS NULL')), > > Thanks > > > > -Original Message-

Re: Joins Conditions Contain Question

2011-02-16 Thread ShadowCross
#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, >  

Re: Joins Conditions Contain Question

2011-02-16 Thread ShadowCross
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

Re: How to inherit / extend a content class

2011-02-13 Thread ShadowCross
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

Re: Joins across tables?

2011-02-12 Thread ShadowCross
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

Re: Problems with Auth->userScope

2011-02-11 Thread ShadowCross
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

Re: How to inherit / extend a content class

2011-02-11 Thread ShadowCross
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

Re: Populates Multiple Select but does not save selects

2011-02-11 Thread ShadowCross
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

Re: Joins across tables?

2011-02-11 Thread ShadowCross
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

Re: Is this possible w/ CakePHP? Using HABTM insert of multiple records/rows (with multiple select box)

2011-02-10 Thread ShadowCross
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

Re: HABTM w/ Multiple Select type Field and saveAll() on multiple records.

2011-02-10 Thread ShadowCross
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

Re: Avoiding redundant find() calls when building model methods

2011-02-09 Thread ShadowCross
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

Re: Global Variable

2011-02-09 Thread ShadowCross
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

Re: php statement as to appear replaced in views

2011-02-09 Thread ShadowCross
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 &

Re: HABTM w/ Multiple Select type Field and saveAll() on multiple records.

2011-02-09 Thread ShadowCross
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

Re: Custom Variable in Model based on virtual field

2011-02-09 Thread ShadowCross
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

Re: V1.3 use of plugins vs vendors: accessing css, js, images, etc.

2011-02-09 Thread ShadowCross
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

Re: can you help me please

2011-02-09 Thread ShadowCross
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"';

Re: php statement as to appear replaced in views

2011-02-09 Thread ShadowCross
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

Re: php statement as to appear replaced in views

2011-02-07 Thread ShadowCross
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

Re: Using EmailComponent inside a component or abstract controller

2011-02-07 Thread ShadowCross
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

Re: Need advice for custom ACL

2011-01-27 Thread ShadowCross
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

Re: Join Tables between db

2011-01-27 Thread ShadowCross
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

Re: Need Ajax Help

2011-01-24 Thread ShadowCross
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 '

Re: .htaccess for https site

2011-01-24 Thread ShadowCross
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

Re: Ordering by associated dates

2011-01-24 Thread ShadowCross
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

Re: php statement as to appear replaced in views

2011-01-24 Thread ShadowCross
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