SecondController extends FirstController extends AppController: not supported? --psybear

2011-01-31 Thread psybear83
Hey everybody I'm refactoring an application with some controllers and wanted to "divide" them into a group X (that needs some components) and a group Y that needs some other components. My idea: class AppController { var $components = array('Html', 'Form'); } class XController extends AppCont

Is there a way to make all view context available in a helper's method? --psybear

2011-01-28 Thread psybear83
Hey everybody I have a helper which should behave in different ways depending on the actual controller and action. But I don't like to pass this information as parameters. So I wanted to know - is there a way to let the helper know this without having to pass it every time as a parameter? Thanks,

Translating the scaffold flashes - it nearly can't be done the way they are formatted?! --psybear

2011-01-27 Thread psybear83
Hey everybody I want to translate the flash messages of $scaffold (I know, $scaffold shouldn't be used, don't tell me this ;-) ). I looked through the code to find the msg-strings, and for deletion, they look like this: $message = __( sprintf('The %1$s with id: %2$d has been deleted.', Inflect

My "Contract" model test asks for "User" fixtures and I have no idea why --psybear

2011-01-26 Thread psybear83
Hey everybody I have a model Beneficiary and a model Contract. class Beneficiary extends Model { var $name = 'Beneficiary'; var $hasMany = array( 'Contract' ); } class Contract extends Model { var $name = 'Contract'; var $displayField = 'number'; var $belongsT

DEBUG=2: My error500 shows; DEBUG=0: I get "not found". --psybear

2011-01-25 Thread psybear83
Hey everybody When having DEBUG set to 2 (or 1), my sweet little error500 is shown correctly. SomeController extends AppController { function _error500() { $this->cakeError('error500'); exit; } } But when it's set to 0, then I'm just getting a plain "Error: Th

Small question about L10n: Configure::write('Config.language', 'de'); doesn't seem to do anything? --psybear

2011-01-24 Thread psybear83
Hey everybody I'm currently doing l10n for my web. I have browsed through some articles, and their alltogehter-verdict was: - Put "uses('L10n');" into your AppController. - Put "Configure::write('Config.language', 'de');" into your bootstrap.php File - Change the display language by setting the s

$this->Form->select(...) creates HTML tag with ID, but with empty name! --psybear

2011-01-24 Thread psybear83
Hey everybody I wish you all a good start into the new week. :-) Sadly the first thing I encountered after starting the PC today at my workplace is a strange little problem. View: Form->create(array('action' => 'detailangaben', 'type' => 'get')); ?> Geburtsdatum Form->

Do I still need Model::$whitelist when using the Security component? --psybear

2011-01-21 Thread psybear83
Hey everybody to my knowledge, the $whitelist attribute tells a model, which attributes should be writable when it comes to a save. I'm using the Security component which ensures that nobody tampers with my forms (e.g. adding a new input field), so I guess I don't need $whitelist anymore, right?

Having a little trouble with url rewriting on production server --psybear

2011-01-21 Thread psybear83
Hey everybody I never had to deploy a CakePHP app to a production server before, and now I'm a bit stuck. While my app works like a snap on my development machine, URL rewriting doesn't seem to work on the production server. This means: everything works fine as long as I access the app with myapp

Can't get Form->select() with *no* empty value to work in 1.3 --psybear

2011-01-19 Thread psybear83
Hey everybody This is a very basic one, but I'm just not getting it, and it's beginning to drive me nuts. According to this 1.3 guide (http://book.cakephp.org/view/1566/View- and-Helpers), I sohuld use 'empty' in select so my has no empty value. Form->select('dienstmodell', $dienstmodelle, arra

Test protected methods (PHP5) in SimpleTest? --psybear

2011-01-14 Thread psybear83
Hey everybody I'm currently writing a library for a CakePHP projekt, and I'm using the new PHP5 OOP features like protected methods. Now I'd like to be able to test them, but I don't know how to do it because I can't access them from within a SimpleTest file. My dirty solution would be to just s

ApiGenerator plugin: Exclude plugins directory... and some other questions. --psybear

2011-01-13 Thread psybear83
Hey everybody I'm trying to get the ApiGenerator plugin to do what I want. I have placed it in myapp/app/plugins, and built the index using cake api_index update Now I have some problems... 1) I don't want the ApiGenerator to generate the API for the myapp/ plugins directory, because in there i

SimpleTest: assertEquals does not work with DateInterval objects! --psybear

2011-01-06 Thread psybear83
After debugging for 2 hours or so, I finally found the problem why my tests work (but shouldn't)... $x = new DateInterval('P36Y'); $y = new DateInterval('P34Y'); $this->assertEqual($x, $y); This passes (and it clearly shouldn't in my opinion)! To prove: debug($x); debug($y);

Documenting a small CakePHP project: Best practices? --psybear

2011-01-04 Thread psybear83
Hey everybody I have to start a small CakePHP application from scratch. I want to do this in a highly professional way, which also means that I want to properly document the project. Besides documenting the sources properly, I'm wondering how to document other stuff centrally, e.g. business rules

How do you guys structure your shared components/behaviors/plugins repository (Subversion)? --psybear

2011-01-04 Thread psybear83
Hey everybody I wonder how to structure my shared components, behaviors, plugins etc. in my Subversion repository? I include them as externals in many different projects, and because I can't point to single files as externals (but only to directories) I can't simply use a structure like - compone

Empty automagic dropdown lists make Security component complain? --psybear

2010-12-30 Thread psybear83
Hey everybody I just noticed that when I'm having an empty dropdown list and send it, then its key in the data (e.g. data[Comment][post_id]) goes missing, and I get a blank screen (probably because the Security component thinks the form was manually changed). Is this normal? Is there a fix for th

find('list') with conditions of joined tables? --psybear

2010-12-16 Thread psybear83
Hey everybody I want to use find('list') that uses conditions of joined tables. But it seems find('list') doesn't support that? Example: I have a model User which hasOne UserProfile. $userProfile->find('all', array( 'conditions' => array( ) )); ...works like a

Limitation of behaviors when it comes to parent:: calls? --psybear

2010-12-14 Thread psybear83
Hey everybody I think I really ran into a limitation of the behavior mechanism and I wonder whether there's an elegant solution. I have a simple behavior called AllowanceCheckable which basically just adds 4 methods to the model: class AllowanceCheckableBehavior extends ModelBehavior { functio

Attach behavior to AppModel on the fly? --psybear

2010-12-14 Thread psybear83
Hey all I'd like to add a behavior to the AppModel on the fly from within a component. Normally you do... $this->Controller->MyModel->Behaviors->attach('MyBehavior'); ...but sadly for AppModel this doesn't work: $this->Controller->AppModel->Behaviors->attach('MyBehavior'); ...results in: Fata

Form helper: send default values as named params? --psybear

2010-12-13 Thread psybear83
Hey guys I'm creating a form using the Form helper, and I'd like to send default values using named params: /users/add/first_name:max/last_name:miller I've already come so far that the input() accepts default values for text fields and dropdown lists: echo $this->Form->create(null, array('url'

Model1->Model2->find(...): I need an INNER join, but where to specify? --psybear

2010-12-13 Thread psybear83
Hey everybody I have a User and a UserProfile model: class UserProfile extends AppModel { var $name = 'UserProfile'; var $belongsTo = array( 'User' ); } class User extends AppModel { var $name = 'User'; var $hasOne = array(

Simple "join => array('Post')" creates invalid SQL command! --psybear

2010-12-11 Thread psybear83
Hey everybody class MetaTag extends AppModel { var $name = 'MetaTag'; var $displayField = 'name'; function allowsAdd(&$user, $options) { $this->find('count', array('joins' => array('Post'), 'conditions' => array('MetaTag.id' => $this->id(; } }

Is it okay to have a hasOne relation, where some records DON'T have one? --psybear

2010-12-07 Thread psybear83
Hey everybody I have just split up my User model into a User and a UserProfile model, because I wanted to prevent my User model from having too much fields (address data, profile data etc.). So now my User hasOne UserProfile. But there are some users that DON'T have a UserProfile - these are main

$scaffold: Display only certain fields to the user (index/view)? --psybear

2010-12-02 Thread psybear83
Hey everybody I guess that's a newbie question, but I didn't find an answer yet... So: is there a way to only show certain fields of a model to the user when on the index or view page? Thanks Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP rela

Have my own Controller::var variable that is not overridden by descending AnotherController::var (but merged)? --psybear

2010-12-02 Thread psybear83
Hey everybody I know that CakePHP applies some magic to inheritance. So when having a class... class AppController extends Controller { var $uses = array('Model', 'AnotherModel'); } ...and then extending another one from it... class AnotherController extends AppController { var $uses = arra

$scaffold: When overriding the index() method, I get "view for index not found"! --psybear

2010-12-01 Thread psybear83
Hey everybody I'm developing a small application that is only used in-house of a small company which should be able to be extended as fast as possible and everything should be dynamically magically handled as far as possible. All in all the app is needed for data manipulating, so it is a typical

Web tests: how do they stop when an error occured (e.g. when a behavior file can't be found)?

2010-12-01 Thread psybear83
Hi all I want to tweak CakePHP's web tests. I find it absolutely not useful that they continue to run after an assertion failed, because most of the time when one assertion fails, then the rest of the tests won't pass, too. So I wonder where to "hook" into the code. I have already discovered the

Forms security: Not displaying input means it is protected? --zivi-muh

2010-11-26 Thread psybear83
Hey everybody In my application, users can edit their email, phone number etc., but they are *not* allowed to edit their username - only admins are allowed to do that. So I'm wondering: is it safe to simply not display the username field to the user? Afaik CakePHP makes sure that the form hasn't

Which upload plugin/behavior/component do YOU use? --psybear

2010-11-24 Thread psybear83
Hey guys I'm currently planning to add file upload features to my CakePHP application. I used MeioUpload (http://www.meiocodigo.com/projects/ meioupload/) so far, but it seems a bit buggy to me - I didn't get web tests running with it (I'm not really sure whether MeioUpload is the problem or Simpl

Can AppError be outsourced to a plugin? --psybear

2010-11-24 Thread psybear83
Hi everybody I have created a small custom ErrorHandler which I'd like to share between projects. Sadly I'm not too lucky getting it to work as a plugin. I have only these 3 files so far (the main purpose for my error handler is that it dislays errors not in the default layout but in its own error

Controller::__mergeVars() automatically adds model class to Controller::uses that doesn't exist! --psybear

2010-11-23 Thread psybear83
Hey everybody Because I need it in every controller, I have added 'User' to AppController::uses. But then something strange happened: When calling my SearchController, I got the error that the table searches for the model Search doesn't exist. The funny thing: there IS no Search model. I tracked t

Behaviors that arm models with new public methods, e.g. $model->readRandom()?

2010-11-22 Thread psybear83
Hi all I have some functionality in my AppModel that I'd like to publish as a plugin or so, so I can re-use the code in other projects. So far it looks like this: class AppModel extends Model { function readRandom() {} } Now one possibility is to extract my functionality into a class that wil

Lost track of my ACL groups, members etc: How to get an overview back?

2010-11-22 Thread psybear83
Hi all I have some groups and a lot of users, and I have lost track of what group is allowed to do and who belongs to which group etc. Is there an easy way (without having to dig through the whole database) to display those relationships? E.g. a tree view that displays all groups, what the groups

How to determine whether there's an $id passed to an action? --psybear

2010-11-18 Thread psybear83
Hi all I'd like to have a beforeFilter in my AppController which - whenever the view, edit or delete is accessed - automatically fills the AppController::model variable with the data of the passed $id. So I need to get the ID of the model from the URL in the beforeFilter. Sadly the $this->params

Model data array: how to examine which model it comes from?

2010-11-18 Thread psybear83
Hi everybody I have a User model which when loaded results in something like the following array: Array ( [User] => Array ( [id] => 3 [name] => posts_editor [password] => 9fb00060ce49a5d5fab91b350b1529fda941a1de [superuser] => 0

Trying to test a controller but autoRender=false doesn't seem to stop rendering!

2010-11-17 Thread psybear83
Hi all That's my automatically generated controller test: redirectUrl = $url; } } class CommentsControllerTestCase extends CakeTestCase { var $fixtures = array('app.comment', 'app.user', 'app.group', 'app.active_user'); function startTest() { $this->Comme

Is there a reason why I shouln't make $this->Html available in views as $html? --psybear

2010-11-12 Thread psybear83
Hi everybody For the sake of simplicity I'd like to make my helpers available in my views not as $this->Helper but as $helper using the set(...) method in the controller. Is there any reason why this could be a bad idea? Or is there already an option to tell CakePHP to make the helpers available

CakePHP should be more strict with unclean configuration, e.g. when specifying missing components! --psybear

2010-11-12 Thread psybear83
Hi all I don't get it why CakePHP doesn't complain about stuff like when one specifies missing components or fixtures: var $components = array('SomeNotExistingComponent'); var $fixtures = array('app.this_fixture_does_not_exist'); App::import('Lib', 'TheresNoSuchFileInLib'); All the three lines d

beforeFilter() after initialization of components but before beforeRender? --psybear

2010-11-11 Thread psybear83
Hi all Is there a filter that runs after the initialization of components but before beforeRender? Thanks for help Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the G

Auth: doesn't this work without Acl component? --psybear

2010-11-11 Thread psybear83
Hi everybody I'm working with an existing app which uses the Auth and Acl components. But because the default Acl component is much too complex for the needs of the application I want to get rid of it and only use the Auth component with my own small implementation of Acl. Sadly when removing Acl

ActsAs Tree without MPTT? --psybear

2010-11-10 Thread psybear83
High everybody I wonder whether there's a way to disable MPTT in the ActsAs Tree behavior? I like modifying my data manually in the database, and so MPTT is just something that complicates stuff... Thanks for any hints Josh Check out the new CakePHP Questions site http://cakeqs.org and help othe

I removed the Acl component from AppController, but my app still asks for the aros/acos tables! --psybear

2010-11-09 Thread psybear83
Hi all I have taken over an existing application which relies on the Auth and Acl components. The application is rather small and won't grow much in future, and because the whole ARO/ACO data in the database looks quite chaotic and not easily maintainable to me, I'd like to remove the Acl componen

Is there a better web interface for SimpleTest?

2010-11-09 Thread psybear83
Hi all CakePHP's web interface is nice, but it is *very* basic. It would be a lot nicer if one could e.g. - choose which tests to run within a suite - choose to abort testing when an error/fail is found (often the other tests won't work in this case, either, and it's a waste of time to let them s

Creating an ACO using the console results in "Error: Class CreateShell could not be loaded" --psybear

2010-11-08 Thread psybear83
Hi everybody I just upgraded my OSX from Leopard to Snow Leopard, and now when I'm trying to create an ACO using the console I'm getting a "Error: Class CreateShell could not be loaded". Anyone has an idea why? Before upgrading this worked flawlessly. Thanks, Josh Check out the new CakePHP Ques

ACL and Auth: Check if logged in user has same ID as passed by the URL? --psybear

2010-11-05 Thread psybear83
Hi everybody My application uses ACL and Auth. Every user should be able to edit his own profile. For this I check on every request whether the currently logged in user is the same as the one who's ID was submitted in the URL (users/edit/123). The following method existed in the app since early C

build_acl() method creates too much acos! How to make non-action-methods private? --psybear

2010-11-05 Thread psybear83
Hi everybody I wanted to update my ACOs table and found this useful build_acl() method from http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs I ran it, and it produced the following: [0] => Created Aco node for controllers [1] => Created Aco node for Pages [2] =>

Does every model really need a "name" field? --psybear

2010-11-04 Thread psybear83
Hi everybody A collegue told me some time ago, that every CakePHP model needs a "name" field in the database. However, he couldn't really tell me why's that, and I don't really find too much information about that. So maybe this isn't true (anymore)? Or if it's really the case, then what do you g

Is there a standard way of making sure that foreign keys exist?

2010-11-04 Thread psybear83
Hi everybody Before creating a behavior myself I wanted to ask this (see title). I only found this: http://ask.cakephp.org/questions/view/how_to_check_the_validness_of_a_foreign-key_must_contained_in_primary-key_list ...but there's no solution for the problem. If nothing like this exists yet, I

blackHole($controller, $string) leads to "Missing argument 2 for AppController::blackHole()" *+

2010-11-03 Thread psybear83
Hey guys I've implemented a blackhole in my AppController: function blackHole($controller, $error) { trigger_error(__('You have been black holed because something went horribly wrong!', true), E_USER_WARNING); die; } Sadly I'm getting a "Missing argument 2 for AppController::blackHole()" whe

Display a 404 when a record isn't found and redirect?

2010-11-03 Thread psybear83
Hi everybody I'm currently making sure that invalid IDs in URLs are catched and the user is informed about the invalid ID. So far I just set a flash message and redirected to the index, but now I'm wondering whether I should also send a 404 header in addition to this? Thanks Josh Check out the n

Standard mechanism for telling why a record hasn't been deleted?

2010-11-02 Thread psybear83
Hi all Is there a standard mechanism for telling why a record hasn't been deleted? When a record isn't deleted, it just tells "Xxx was not deleted", but without any reason. So for example, when I'm creating a beforeDelete(..) hook that prevents the record from deletion, how should I let the user

Subclassing TestSuite: put a class "BetterTestSuite" between MyGroupTest and TestSuite does not work?

2010-11-02 Thread psybear83
Hi everybody I'm having the following test group: class MyGroupTest extends TestSuite { function __construct() { TestManager::addTestFile($this, APP_TEST_CASES.DS.'views'.DS.'applications'.DS.'bla1.test.php'); TestManager::addTestFile($this, APP_TEST_CASES.DS.'views'.DS.'applications'.D

Sent mails don't arrive in Outlook Exchange mailboxes!

2010-10-29 Thread psybear83
Hey everybody I noticed that mails sent using the Email component (without using SMTP or stuff) don't arrive at my office's email, which is run using Outlook Exchange. When sending to my private email provider, it works flawlessly. I guess it could have something to do that Outlook has a stricter

After upgrade from 1.2.x to 1.3.5: related models aren't loaded automatically anymore?

2010-10-28 Thread psybear83
Hey guys Yes, it's me again... Cleaning up some dirty codes from my antecessor. I have a User model that can export some INI data with a getIni() method. The User model is related to many different models that server some data for the INI data: function getIni() { $data = ''; $data .= 'stree

Change a field's value after changing another field using Model->set(...)

2010-10-28 Thread psybear83
High everybody I have a model with two fields. The first field is altered using Model- >set(), and as soon as this happens, I want the other field to change its value (to the current time), too. Is there a hook mechanism or something that can be used to do that? Thanks, Josh Check out the new Ca

Why only pass $data to view instead of model instance?

2010-10-28 Thread psybear83
Hi everybody Something I don't really like in CakePHP is that one seems to be always only working with the $data array instead of "real" model instances. I hate to name Ruby on Rails again, but in RoR, I normally pass a model instace to a view, and there I can do handy stuff like calling methods o

Get a model object instead of an array when calling $this->Model->find(id)

2010-10-27 Thread psybear83
Hi everybody This seems pretty basic, but I just don't get it to work... I have a model User with a method: function getIni() { return "some INI stuff"; } Then I have an action downloadIni() in UsersController: function downloadIni() { // ... $user = $this->

Download some plain text

2010-10-26 Thread psybear83
Hi everybody I want to give my users the possibility to download the content of the model IniFile's field "text" as plain text. I came up with the following solution: function exportIniFile() { $iniFile = $this->IniFile->find($this->params['named']['id']); header("Content-type: text/pl

$this->Author->set(...)/find(...) creates other $data array than the one a form creates (case of the keys)

2010-10-20 Thread psybear83
Hi everybody I just stumbled over the following problem. I have a method concatName() in my User model that is called when an author is validated: function concatName($data) { return $data['User']['first_name']." ".$data['User']['last_name']; } In live action, this works well so far. But in

Model tests: is it normal that I have to load associated models' fixtures as well?

2010-10-20 Thread psybear83
Hi all I'm tesing a comment model. Every comment belongs to a post. Every post belongs to a user: Comment > Post > User When unit testing a comment, it seems I have to load all the fixtures of post and user too! Is there a way to prevent this (I'd like to get some more performance)? I tried set

So methods that are not an action should have a "_" in front of it?

2010-10-19 Thread psybear83
As mentioned before, I have taken over an existing CakePHP application... and it's not a very good one. I'm working since a month or more on things like writing tests (there haven't been any before), cleaning and rewriting code etc. So now I stumbled over some methods in a controller that aren't a

Dates before 1600-01-01 are not recognized by models' date fields?

2010-10-19 Thread psybear83
Hi everybody Is there a reason why CakePHP doesn't recognize dates before 1600-01-01? I get a validation error when submitting a date before that (e.g. 1599-31-12 or 1300-11-05). Thanks, Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related q

Easiest way to get data from a model (better way than $model->data['modelname']['field'])?

2010-10-19 Thread psybear83
Hi everybody Sorry for this newbish question, but I don't seem to find much about this (although I should, I guess). $m = $this->Model->find(1); echo $m->data['Model']['something]; Is there a better way of getting a model's data fields instead of this? I always thought this could be done with $m

Annoying WSOD when doing testing and db settings don't work

2010-10-15 Thread psybear83
Hi everybody When the db settings don't work, then calling a test case in test.php results in a WSOD. This is really annyoing. Is there a cure? Couldn't find one myself... Thanks Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions

Test fixtures: Why is there always one more INSERT than there are tests?

2010-10-15 Thread psybear83
Hi all I wonder why when I have 0 tests in my post model test case, I have 1 "INSERT into posts", and when I have 123 of themk, I have 124 INSERT, etc. Where does this INSERT in front of starting any test come from? Anyone has an idea? Thanks Josh Check out the new CakePHP Questions site http:/

Is there an easy way to tell CakePHP to use another db setting instead of $default?

2010-10-15 Thread psybear83
Hi everybody Is there an easy way to tell CakePHP to use another db setting instead of $default? Maybe something like Configure::write('please.let.me.use.this.database', 'test'); Thanks a lot Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP rel

Block every http connection except mine using .htaccess mod_rewrite?

2010-10-15 Thread psybear83
Hi everybody I have to deploy a new version of my CakePHP application today. Sadly I don't really have control over the server it is deployed to, and I can't guarantee that nobody will try to use the website while I'm trying to deploy the new version (it's the first time I deploy, so I will need s

Re: Web tests using fixtures: Finally got them working!

2010-10-13 Thread psybear83
Yeah, it was quite late that day... So finally here's the link to my blog post... ;-) http://josh.ch/wordpress/?p=8 On Oct 13, 6:13 pm, psybear83 wrote: > Hi everybody > > After long days of hard work I finally got web tests running using > fixtures. I wrote a blog post abo

Web tests using fixtures: Finally got them working!

2010-10-13 Thread psybear83
Hi everybody After long days of hard work I finally got web tests running using fixtures. I wrote a blog post about this (my first post in my first blog ever!), so if you're interested please take a look at it. Any good advice is welcome (whether it's about my not-so-very- experienced blogging-sk

Testing file uploads using SimpleTest web tests?

2010-10-06 Thread psybear83
Hi everybody After suffering hours of debugging the problem that my upload form worked great when used in Firefox and not working (being blackholed) using SimpleTest web tests, I finally found the problem: SimpleTest doesn't seem to recognize the file upload field, and so the SecurityComponent::_v

Does SimpleTest provide an assertion that there's a link pointing to $url?

2010-10-05 Thread psybear83
Hi all In my application, many link captions are ambiguous ("Edit" etc.). So I'm having problems letting SimpleTest assert and click a certain link (e.g. the Edit link for item #123). So it'd be great if there's something like clickLink('Edit', '/items/edit/123'); Is there something like that?

Is there a way to stop SimpleTest from executing any more tests when on has failed?

2010-10-05 Thread psybear83
Hi everybody I'm doing some web tests, and normally it's useless to continue with any more tests after one test has failed. So is there a way to prevent SimpleTest from doing this? Thanks Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related

Get stack trace in black hole callback?

2010-10-05 Thread psybear83
Hi all I'm having problems with debugging a white screen of death, and so I set up a blackHoleCallback in AppController: function beforeFilter() { $this->Security->blackHoleCallback = 'blackHole'; } function blackHole() { // TODO: Nur ausgeben, wenn in

Security: Token is not accepted anymore when creating/updating user

2010-10-04 Thread psybear83
Good new week, everybody. I just noticed that I can't create/updated users anymore in my app. I'm always getting a white screen of death when trying it. I tracked it down to the security component that checks the submitted form data (_validatePost()), and the token submitted through the form doesn

Strange blackHoleCallback behavior

2010-10-04 Thread psybear83
Hi all Because I didn't like the white screens of death (WSOD) I was facing from time to time, I decided to add a blackHoleCallback to my application controller. # app_controller.php function beforeFilter() { $this->Security->blackHoleCallback = 'blackHole'; } function blackHole() { die("B

Tracking down WSOD: Some problems with users controller and acl component

2010-10-01 Thread psybear83
Hi everybody I'm having another nasty white screen of death and I'm tracking it down right now. I came down to the following... I'm having a UsersController that uses the Acl component. When trying to create/update a user (after submitting the form) i get the feared WSOD. The execution of my cod

beforeCreate() and afterCreate(): better implementation than mine?

2010-09-30 Thread psybear83
Hello folks >From Ruby On Rails I know the beforeCreate() and afterCreate() hooks of models. I didn't find them for CakePHP, so I implemented them myself: function isNewRecord() { return empty($this->id) || $this->field('created') == $this- >field('modified'); } function beforeSave() {

CakePHP ignores notEmpty validation rule when the field's name is not a key in $data! (Bug or Feature?)

2010-09-30 Thread psybear83
Hi everybody I have baked the following very straight-forward model: class Post extends AppModel { var $name = 'Post'; var $displayField = 'name'; var $validate = array( 'name' => array( 'notempty' => array(

Manually set date field using a string "YYYY-MM-DD" does not work?

2010-09-30 Thread psybear83
Hi everybody Take a look at the following code: $this->Contract->create($this- >getValidDataExcept(array('date'))); // Creates a nearly valid contract (only date is missing) debug($this->Contract->field('date')); // (empty) - ok debug($this->Contract->validates()); // 1 debug($thi

Re: New model obj doesn't get populated with data after set() and save()?

2010-09-29 Thread psybear83
generated value (should be the same) } I'm quite happy with this test, but I don't really see why I have to store the saved data in a $data array? I'd rather would do the following: ... $o->save(); $this->assertEqual($o->field('name'), $this->validData[

New model obj doesn't get populated with data after set() and save()?

2010-09-29 Thread psybear83
Hi all Why is a new model object not populated with data etc. after creation? $o = new Contract(); $o->create(); $o->set($this->getValidDataExcept(array('number' => '555-66-777'))); $o->save(); // The save works - an array with fields' data is returned debug($o->field('number'

Model validates when needed field is not available in $data array!

2010-09-29 Thread psybear83
Hi everybody I'm doing some unit testing right now, and I stumbled over the following... I have a model Contract, which has the following validation rule: class Contract extends AppModel { var $name = 'Contract'; var $validate = array( 'number' => array('rule' =>

Big problems trying to use "medium" as a model name

2010-09-24 Thread psybear83
Hi everybody I have upgraded a CakePHP application from 1.2.0.x to 1.3, and everything works quite fine now, except one thing. I have a "Medium" model (which will hold data of books, DVD's, newspapers etc.), which has a HABTM relationship to an "Author" model. In version 1.2. this was no problem,

1.2 to 1.3: Auth component: login does not work anymore

2010-09-23 Thread psybear83
Hi everybody After upgrading from 1.2 to 1.3 my login (using the Auth component) doesn't work anymore. I'm trying to find the code where username and password are checked, but I couldn't so far. Anybody can give me a hint? Ah yeah, and the following errors/warnings occur now when trying to log in

1.2 to 1.3: Notice (8): Undefined variable: session [APP/views/layouts/default.ctp, line 103]

2010-09-22 Thread psybear83
Hi everybody I'm upgrading to v1.3 and have some problems I couldn't figure out yet... In my layouts/default.ctp I have the following code: check('Message.flash')) { $session->flash(); } if ($

Cake bake db setup: Fatal error: Class 'DATABASE_CONFIG' not found in db_config.php

2010-09-22 Thread psybear83
Hi all I have a fresh CakePHP 1.2.8 copy on my server and want to bake something. But sadly I'm getting the following error when setting up the db connection: macbuech:tests josh$ cake bake Welcome to CakePHP v1.2.8 Console --- App : t

After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"

2010-09-22 Thread psybear83
Hi everybody I have overtaken a CakePHP application which used an out-dated version of CakePHP (1.2.0.x), so I upgraded it to 1.2.8. Everything worked fine before, but now I have problems with HABTM relations: $authors = $this->Medium->Author->find('list', array('order' => 'Author.name')); resul

Change the Show/Edit/Delete links in the scaffold's index?

2010-09-21 Thread psybear83
Hi all Instead of Show - Edit - Delete I'd like to have Show (ID) - Edit (ID) - Delete (ID) in my scaffold's index. Is there an easy way to implement this *without* having to use hard-written index.ctp files? Thanks Josh Check out the new CakePHP Questions site http://cakeqs.org and help oth

PHP Errors are not printed to screen

2010-09-20 Thread psybear83
Hi everybody I'm still fighting with a CakePHP application I've overtaken from somebody else, and it's a bit a mess. One thing I still couldn't figure out is why PHP Errors aren't printed to screen in my application. I've set define('LOG_ERROR', 2); Configure::write('debug', 2); in core.php, bu

What's the "@" in front of @$this->params['controller']?

2010-09-16 Thread psybear83
Hi all I haven't done PHP coding for several years now, and I wonder what's the "@" in front of some statements I found in the view of our web application: @$this->params['controller'] Thanks a lot for help Josh Check out the new CakePHP Questions site http://cakeqs.org and help others with th

hasMany: check for depending objects when deleting and deny?

2010-09-16 Thread psybear83
Hi all I know that I can use the dependent flag to automatically delete all the associated model objects. But I'd rather have an option to prevent deletion of the object as long as it's having other depending objects. Is there an easy way to do this? Thanks a lot Josh Check out the new CakePHP

I want the flash to be displayed on the page it normally redirects to!

2010-09-16 Thread psybear83
Hi everybody Instead of having a flash displayed for some seconds and then being redirected to the next page, I'd like the flash message to be shown on this "next page" itself! So instead of add user -> show flash -> user index I want add user -> user index (while showing flash somewhere on th

Validations: VALID_NOT_EMPTY vs notEmpty

2010-09-16 Thread psybear83
Hi everybody I wondered what's the difference between VALID_NOT_EMPTY and notEmpty? In my model, when I use 'loginRule-1' => array( 'rule' => 'notEmpty', 'message' => 'This information is mandatory', 'last' => true ), ... the rule doesn't work

Bakery bakes buggy code for controller actions?!

2010-09-16 Thread psybear83
Hi all That's the delete action which Cake baked me: function delete($id = null) { if (!$id) { $this->flash(__('Invalid User', true), array('action' => 'index')); } if ($this->User->del($id)) {

Anyone knows what's the component RefererRedirect for?

2010-09-16 Thread psybear83
Hi everybody I've overtaken an existing CakePHP project. In various controllers I find calls to RefererRedirect in the source code (add/edit actions), e.g. $this->RefererRedirect->prepare(); $this->RefererRedirect->redirect($id); It seems to be a component, which is loaded in AppController, but

Development/Test/Production environment not really separated things in CakePHP?

2010-09-16 Thread psybear83
Hi everybody I wonder why the development, test and production environments seem to be *not* really separated things in CakePHP? I want to do the following: I'm writing web tests for my web application using CakeWebTestCase. Let's say I'm programming the SimpleTest browser to open users/add, ente

Re: $this->flash(...) does not redirect

2010-09-16 Thread psybear83
Oh, thank you! On Sep 15, 7:34 pm, Tilen Majerle wrote: > emm...manual is in core.php before > {{{ > > Configure::write("debug", 0); > > }}} > > -- > Tilen Majerlehttp://majerle.eu > > 2010/9/15 psybear83 > > > Thank you! Where is the manual y

Re: $this->flash(...) does not redirect

2010-09-15 Thread psybear83
Majerlehttp://majerle.eu > > 2010/9/15 psybear83 > > > Hi everybody > > > I have  baked CRUD for my Users controller, but it seems that the > > generated code is buggy...?! > > > As to my understanding, $this->flash(...) should redirect to the page > >

$this->flash(...) does not redirect

2010-09-15 Thread psybear83
Hi everybody I have baked CRUD for my Users controller, but it seems that the generated code is buggy...?! As to my understanding, $this->flash(...) should redirect to the page specified in the supplied 2nd argument. But whether my add nor my edit actions redirect - they just show a blank page

Error: Database table test_suite_acos for model Aco was not found.

2010-09-14 Thread psybear83
Hi everybody When doing a UNIT test I always get this error: Error: Database table test_suite_acos for model Aco was not found. I'm very new to CakePHP and have overtaken an existing project for which I'm creating a good test battery now. So does anybody have an idea what's this error about? T

  1   2   >