Re: Strange session problems ;-(

2006-07-03 Thread Christian.Tietze

Well, it's not obvious what really changes things here... You could try
to pr($data); if there's something wrong inside your result (but you
should've noticed that in your view, hmm :))... Probably Session::write
returns true or false, depending on the sucess of writing. You could
try:

if ($this-Session-write(...)) {
  echo 'Works fine. ID: ' . $id;
}

Debunng 3 lines of code isn't easy :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: custom foreignKey not working in depper associations

2006-06-25 Thread Christian.Tietze

Has been fixed yesterday, phew :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



custom foreignKey not working in depper associations

2006-06-24 Thread Christian.Tietze

Hi!

Please excuse this rather long post; my English isn't that advanced and
therefore it's ahrd to explain things the short way. Maybe I'm going to
say the same thing twice, using another expression or so, hoping you
can get the meaning out of them combined :)

To describe my problem: If I show a news item, the comments are
associated (i show them as well) and for each comment there's a user.
The news and the comments refer to the user via
   'foreignKey' = 'author_id'
because that makes more sense than user_id would do while reading and
writing the templates.

That's no big deal, though. I created a static page, so only the
sidebar contains a query to fetch the logged-in user's details.
I associated news and comments to the user via User::hasMany, changing
the foreignKey value to 'author_id' as well (as proposed in the manual
on hasMany: http://manual.cakephp.org/chapter/6).
For the sidebar there is a query for the user's data which leads to a
query for his news and comments. Using debug mode on level 2, I see the
query, and there are 3 news and 1 comment fetched. That's what there is
in my DB, so everything is fine.


Yeah, now there's a problem though.

Then I show a single news post, written by me. One of the 3 the DB
found for my user data above.
The news post is fetched and the author (refered to as 'Author' in my
relationship, so its SELECT `Author`.`id` FROM `user` as `Author`
instead of `User`!) can be found as well.
Remember what I told you about querying the DB for a user? Because of a
high 'recursive' value, the author's contents (news and comments)
should be fetched as well. And there's the problem (see the queries far
below).
The news item is there, then the news' author is there, but the news'
authors' comments don't show up, because the author_id is tested on
NULL isntead of an integer value. I suppose the WHERE-clause is made
like this:
' WHERE `Comments`.`author_id` = ' . $someArray['User']['id']
wheras it should be 'Author' as well (because the news refered to the
user this way).

Sounds like some kind of bug to me. The tables' alias is changed in one
query, but all querys afterwards expect the default alias (`User`).
It's hard to express what I think because I lack a lot of English
vocabulary... The supposedly used array index 'User' is derived from
the model's name (class User extends AppModel), a class/model called
Author is not available but supplied by the news. I hope you can get a
glimpse of what I try to say...


Is there a way to fix this? Using User instead of Author for
describing the relationship isn't a good solution since the code will
lack readability then :(

Well, thanks in advance for any suggestions!


- Christian


The SQL queries (hopefully you all got fixed fonts :))

 Fetching the news
SELECT `News`.`id`, [...] ,`News`.`author_id`,
   `Author`.`id`, [...] ,`Author`.`email`
  FROM `news` AS `News`
  LEFT JOIN `users` AS `Author` ON `News`.`author_id` = `Author`.`id`
 WHERE (`News`.`id` = 6)
 LIMIT 1

 Fetching the news' author (id=2 is me)
SELECT `Author`.`id`, [...], `Author`.`email`
  FROM `users` AS `Author`
 WHERE `Author`.`id` = '2'

 Fetching the news' author's comments
SELECT `Comments`.`id`, [...] `Comments`.`author_id`
  FROM `comments` AS `Comments` 
 WHERE `Comments`.`author_id` = NULL


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: HABTM recursively

2006-06-24 Thread Christian.Tietze

I found out that recursion seems to work well. There is a query in
debug mode 2, but the values are wrong; more precisely, the
Comment.author_id is tested with NULL.

Querying for a user only results in all his comments included in the
result as supposed.
Querying for a news item, which queryies for an 'Author', which
therefore queries for comments, that doesn't work. Same with
news-comments-author.
I think that's because the news refer to users as 'Author' (alias in
the query as well) but the author's comments may expect 'User' in some
way, I don't know how cake handles this and I'm not able to find out by
browsing the code :S

Described the whole thing there:
http://groups.google.com/group/cake-php/browse_thread/thread/25035ff3c0a24550/efda7db325b09378


But thanks for your help. Didn't know about the last parameter in
find() :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: -What is the diffrent between $html-hidden and $html-hiddentag ?

2006-06-23 Thread Christian.Tietze

It's just there because of backwards compatibility.

Taking a look at the source (it's always good to have an IDE which
shows a list of every included code available) would tell you the
following

/**
 * @deprecated Name changed to 'hidden'. Version 0.9.2.
 * @see HtmlHelper::hidden()
 * @param string  $fieldName If field is to be used for CRUD, this
should be modelName/fieldName.
 * @param string  $value
 * @param array $htmlAttributes Array of HTML attributes.
 * @param boolean $return Wheter this method should return a value or
output it. This overrides AUTO_OUTPUT.
 * @return mixed Either string or boolean value, depends on AUTO_OUTPUT
and $return.
 */


All the *Tag methods are more or less deprecated; but e.g. there's no
alternative for formTag(), you're supposed to write the form thing
manually, using the HtmlHelper::url() method (recommendation is in the
source as well :)).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: New tutorial for newbies

2006-06-23 Thread Christian.Tietze

Good work - but why do you offer a PDF?
Copying source out of a PDF is just bloody ugly. We're forced to accept
the PDF's line wraps because of the limited page width... A good
looking HTML page (probably you could use wordpress' static pages for
that with some (cached?) syntax highlighting) will serve a coders needs
much better, I think.
I personally prefer HTML because of the accessibility - I can scroll
_fast_ and use the page like any other website or text document.

So please publish your tutorial in HTML and continue up your writing :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Selling CakePHP apps - license changes?

2006-06-21 Thread Christian.Tietze

Hi there!

I looked at the MIT license just a few minutes ago:
http://www.opensource.org/licenses/mit-license.php

You can see this license's URL in every class of CakePHP including
AppController which one has to modify for global changes etc. - you
know all that.
But I wonder whether my application's rights are limited due to this
license... The client receives all the code, the models and the views
and the controllers and he's paying, we're selling, we want money for
our work - so we don't want any of our clients to copy or resell parts
of the code. Deleting any documentation and making the code a pain to
read may be ONE solution, but I don't think that this is a good idea.
The MIT licence, if I really understood what is written there, says
that everyone receiving a copy of the code is permitted to
redistribute, sell and copy it.
That's nice for the framework, but we don't want people to do so.

What do you suggest?
Shall we link to another licence from our own classes?
Shall we think about open source _and_ selling? :) I'm going to publish
useful parts or another version of the software anyway...

Thanks for your advices in advance!

Greetings,
Christian.Tietze


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Selling CakePHP apps - license changes?

2006-06-21 Thread Christian.Tietze

Thanks for your two answers!
Yeah, I copied the app_controller and app_model files into my /app
directory and right now I'm happily changing the class description :)
What I still lack is a new licence. Do I need one? Or is Copyright (c)
2006 Christian Tietze  Daniel van Westen enough? Since we're
freelancers, a lawyer is way outside of our budget.


Olivier Percebois-Garve wrote:
 Better sell expertise, set up, adaptation, customization of code, rather
 than code itself.

Your first point sounds as if we're selling the code for code's sake :)
We develop a management system for small groups, so the content is
somewhat limited, it's a really basic solution. I'm programming the
backend in Cake and my colleague designs our customer's pages. It's my
turn to adjust some things in our product's backend then, so we're
offering a whole website - not just the code, just in case my first
description misleaded you this way.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---