Re: Dealing with 'Order By' with 'View' in MySQL5

2007-01-10 Thread eting747

Error info:
Notice: Undefined variable: data in
/home/eting747/ag4u/cake/libs/model/datasources/dbo_source.php on line
628

cakePHP SQL statement:

SELECT `ArticleHeader`.`id`, `ArticleHeader`.`lot_id`,
`ArticleHeader`.`lot_name`, `ArticleHeader`.`group_id`,
`ArticleHeader`.`group_name`, `ArticleHeader`.`title`,
`ArticleHeader`.`summary`, `ArticleHeader`.`article_type_id` FROM
`article_headers` AS `ArticleHeader` WHERE (`article_type_id` = 1)
ORDER BY `ArticleHeader`.`id` DESC

Environment:
php.i386 5.1.6-3.1.fc6
php-mysql.i386   5.1.6-3.3.fc6
mysql-server.i3865.0.27-1.fc6

On Jan 10, 3:29 pm, "nate" <[EMAIL PROTECTED]> wrote:
> It would be a lot more helpful if you posted the actual text of the
> error with a line number.  Keep in mind, however, that database views
> are not officially supported.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: accessing a controller from a component.

2007-01-10 Thread nate

http://manual.cakephp.org/chapter/request_handler

This is a component, and it shows an example of how to load it.  The
API provides no contextual information for how functions and methods
are used.  If you're a beginner with Cake, you should probably start at
the manual.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Problem with mod_rewrite

2007-01-10 Thread UpWorks

I believe you need to enable write permissions to your app/tmp folder.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: IIS Revisited

2007-01-10 Thread UpWorks


nate wrote:
> What you want, that is.  Not what you're doing.

This:

define('ROOT', dirname(__FILE__));

EQUALS :

d:websites\PlaceOnServer\

Which then makes my links look like this

www.mysite.com/PlaceOnServer/cake/index.php/user/

how can I define $base without the /PlaceOnServer/ in the path is my
question?


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Problem with mod_rewrite

2007-01-10 Thread roby

Thanks for the reply... It works with
http://localhost/username/index.php/users/index... but with some errors
on the page... I don't know why... here is one of them:
Warning:
file_put_contents(/mnt/user/username/app/tmp/cache/models/default_countries)
[function.file-put-contents]: failed to open stream: Permission denied
in /mnt/user/username/cake/basics.php on line 867

Does anyone know how to solve this problem? Thanks in advance.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Performing controller operations in a view

2007-01-10 Thread the_woodsman

Hi Kez,

You say: "I need to perform a fairly complex operation on one column
for each row... "

If these complex operations are primarily about how to present the
data, then a Helper is most appropriate.

If you would consider them to be more business logic than presentation
logic, then you have other options.

"...which involves data from another controller."

Is the data truly from another controller, or is it mainly from that
controller's model?

If the controller, then you could call requestAction() of the other
controller from your current one, and pass the result on to the view.

If this data is really model based, consider putting it straight into
your model- that way it's available directly. If both these
controllers' models are related, you can access an associated model
with someting like

 $this->CurrentModel->AssociatedModel->getData()

Hope that's helpful...


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Order by associated model - need help.

2007-01-10 Thread gourlay

I'm looking for a solution to this same problem.

My setup is something like this:
Job belongsto User
User belongsTo Address

I want to do a find all on Job and order by a field in Address.

Would love to hear from someone on how to handle this scenario.

Thanks,
Nick

Hi Group!

I'm about to go crazy on this one:

A rough sketch of my models, I have Sale belongsTo Emission which in
turn belongsTo EmissionType
Doing Sale->findAll(null, null, 'EmissionType.name ASC', null, null, 3)
wont work...:

Unknown table 'EmissionType' in order clause

The recursion works fine, findAll returns all levels, I can access them
in my view with $data['Emission']['EmissionType']['name']. The
associated levels are added in subsequent queries, as debug shows, but
in my initial query, the table is not available.

My Sale model has the following fields: id, emission_id, bank_id, date,
volume.

What I am  trying to achieve is sorting of the results table by
clicking on the header (a quite common task...) This works fine as long
as the field is in the table Sales (e.g. date or volume) but not on
assiciated field...

I tried bindModel to bind Sales directly to EmissionTypes but the
resulting query got even worse...;(

Anyone encountered such difficulties? Searching the group didn't throw
any matches...

Any suggestions are appreciated.

Greetings

frank


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



findCount and associations

2007-01-10 Thread guysamurai

I have a question about findCount.
Let's say I have a list of Users and each User hasMany Posts
What I want to be able to do is show a list of Users and a count of how
many "expired" and "live" posts they have like this

Bob | 2 Live Posts | 3 Expired Posts
Jane | 0 Live Posts | 4 Expired Posts
Trent | 12 Live Posts | 1 Expired Posts

I have this in my model

$hasMany = array(
'LivePosts' => array(
'className' => 'Posts',
'conditions' => 'live = 1'
),
'ExpiredPosts' => array(
'className'=>'Posts',
'conditions'=>'live = 0'
)
);

In my Users controller I do a findAll with recursive of 1
Then in my view I count up all the 'LivePosts' and 'ExpiredPosts'
items.
This seems horribly inefficient to do since all I'm looking for is a
count of these items and not the items themselves. Is there a way for
findCount to say just count all my LivePosts and ExpiredPosts and store
it as another variable in the controller data array? Has anyone done
anything like this?

Thanks for your help


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: accessing a controller from a component.

2007-01-10 Thread Grant Cox

It should work if you've got var $components = array( 'Places' ) in
your controller - I haven't used "loadComponent" directly before so I'm
not sure how it works.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: IIS Revisited

2007-01-10 Thread nate

What you want, that is.  Not what you're doing.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: IIS Revisited

2007-01-10 Thread nate

Uh, if I understand you correctly, then what you're doing is
impossible.  You can't run a Cake app out of a subfolder and *not* have
the subfolder in your URL path.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Dealing with 'Order By' with 'View' in MySQL5

2007-01-10 Thread nate

It would be a lot more helpful if you posted the actual text of the
error with a line number.  Keep in mind, however, that database views
are not officially supported.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Dealing with 'Order By' with 'View' in MySQL5

2007-01-10 Thread eting747

I am using cakePHP 1.1.12.4205 now. It works with View in MySQL5. But
when I add 'Order By', either in the mysql 'View' definition or in the
findAll( null, null, $order), error jumps out.

I have checked the SQL statement generated by cakePHP and it looks
fine. I copied the SQL statement generated by cakePHP, run it manually
in mysql and proved it to be 100% correct.

My 'View' looks like this:

create view article_headers as
select postings.id as id, group_id, summary, article_type_id
from postings, articles
where postings.id=articles.posting_id
and posting_state_id=1
order by postings.created DESC;

The error shows something wrong with 'data' object in DboSource.php.

After spending a night on this issue, I found out a method to
circunvent this problem. That is sorting the data in another view and
create the target view based on that sorted view. like this:

create view ordered_postings as
select * from postings
order by created desc;

create view article_headers as
select ordered_postings.id as id, group_id, summary, article_type_id
from ordered_postings, articles
where ordered_postings.id=articles.posting_id
and posting_state_id=1;

And now it works.

I think the problem might be somewhere in the mySQL driver instead of
cakePHP itself. Maybe MySQL 5 is too new.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: IIS Revisited

2007-01-10 Thread UpWorks

Excuse the bump.

I have the cake install in a subdirectory of a site. e.g.

mysite.com/subdir
/app
/cake
/vendors

In my IIS cake install I am not using ISIAPI_REWRITE and have defined
IIS and unremed the script_name line in the core.php.

My question is this; what do I need to edit in order to have my links
correct?

currenly they look like this
www.mysite.com/FileDirectoryonServer/cake/index.php?/users/

I need them to be:
www.mysite.com/cake/index.php?/users/

I believe the issue is on this line of index.php:
define('ROOT', dirname(__FILE__));

If the cake install was in the root (actual root) of site it would be
no worries but since I have in a subdirectory it is needing to use the
FileDirectoryonServer to locate the needed includes.

I have tried chaging the define directive to be:
define('ROOT', 'cake');
define('ROOT', '/cake/');
define('ROOT', 'http://www.mysite.com/cake/');

This is the last hurdle before 100% workability of the cake app.

Thank you for any help/suggestions


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread Matt Adams

keymaster wrote:

> A final question: how important are REAL foreign keys in the 
> database, if you are using cake associations. Are they superfluous?
> Are they still needed?

On Jan 10, 2007, at 10:29 AM, Matt Adams wrote:

> They are extremely important if your database offers read-write
> access to more than one application from the same set of tables.  A
> large majority of those who have swallowed the Rails-like pill have
> never worked with large-scale databases and do not understand the 
> necessity of enforcing integrity with foreign keys, triggers and
> stored procedures.

John David Anderson (_psychic_) wrote:

> I've always had mixed feelings about this: in some ways using 
> triggers, stored procedures and the like seem to me like spreading 
> your application logic in too many places. I can see where they'd be
> useful though, too.

I understand the resistance to placing application logic in more than
once place but in situations where two or three or more applications are
accessing the same database it makes much more sense to enforce all of
this in ONE place (i.e., the database) then to try and duplicate the 
same logic correctly through several different applications.

Do you really want to trust the developers from several different teams 
to all interpret the schema correctly and enforce the correct data 
integrity rules for a shared database?  Of course not, people make 
mistakes.  That's why you have your DBA nail down how the relationships 
are going to be set up & used and enforce it in once place.  That way 
the bug that some well-meaning developer in customer applications 
introduced doesn't mangle the in-house service data (assuming the two 
are connected in some way).

Enforcing data integrity in the database isn't about application logic, 
per se although the two domains may have some degree of overlap - it's 
about making sure that two different applications with separate uses of 
the same data don't muck things up badly for the other team.

> Just be sure your app knows how to deal with integrity failures.

Mine might, but I don't want to count on the ugly piece of crap the 
bloke down the hall is writing.  I write this full-knowing that I have 
been that guy down the hall from time to time.


Cheers,

Matt
-- 
BASIC: A programming language.  Related to certain social diseases
in that those who have it will not admit it in polite company.

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



can't generate ajax links in an ajax view

2007-01-10 Thread [EMAIL PROTECTED]

Hello Everyone,

I have a view that uses $ajax->link() to update a div within my layout.
This works fine. However, the ajax layout that I return from the server
also contains $ajax->link's which are not working. I think I traced
this to the Prototype library's update function's following line...

$(element).innerHTML = html.stripScripts();

The links are returned with the html between the  tags but the
following javascript event is stripped by Prototype. So, I end up with
a link that has 'return false;' and no accompanying Observer.

Does anyone know how to get around this? Am I missing an option or
something?

I really appreciate any help that the community could provide. CakePHP
rocks.

Jason


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: $content_for_layout data displaying after footer

2007-01-10 Thread milliseconds

my bad... I had an error in my html in my view.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Simplify foreach() - unpleasant array

2007-01-10 Thread bernardo

I created an iterator for this. You'll need php5.

You can use it like this:

$resiter = new modelIterator("Reservation",$reservations);
foreach($resiter as $reservation) {
echo $reservation['id'];
echo $reservation['created'];
}

The class is very simple:

class modelIterator implements Iterator{

private $model;
private $array;

function __construct($model,$array) {
$this->model = $model;
$this->array = $array;
}

function current() {
$a = current($this->array);
return $a[$this->model];
}

function key() {
return key($this->array);
}

function next() {
next($this->array);
}

function rewind() {
reset($this->array);
}

public function valid() {
return (current($this->array) !== false); 
}

}


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread Gary Choma
I did not encounter that, so see if it's still a problem after double
checking everything. My model diagram looks just like the examples Larry
posted. Only one PK ("id" field) in each table.


On 1/10/07, keymaster <[EMAIL PROTECTED]> wrote:
>
>
> Thanks NOSLOW, I thought I was doing most of the things you mentioned.
> Will double check again, since you had success.
>
> What did you think about the foreign keys being added to a growing
> composite primary key. Didn't that bother you?
>
>
> >
>


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---


Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread UpWorks

I am in the process of writing a definitive tutorial for IIS w/ISAPI
ReWrite and with out used on version 1.1.12.4205+. I will submit to
bakery when Complete.

To Cake People: myself and several others have volunteered time to
assit in moving Wiki from backups into Bakery.

Maybe using a formal invitation you guys can round up a crew of awesome
contributors/matainence peeps.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread keymaster

Thanks NOSLOW, I thought I was doing most of the things you mentioned.
Will double check again, since you had success.

What did you think about the foreign keys being added to a growing
composite primary key. Didn't that bother you?


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: accessing a controller from a component.

2007-01-10 Thread phpjoy

i'm working with php5.

and nope, it still doesn't work..

function startup(&$controller) {
$this->controller = &$controller;
}

and in the component's function:
var_dump($this->controller);
either shows a bool TRUE if i set it up, or a null if i don't set it
up.

if it's not defined at all at the start, i get an error too.

[EMAIL PROTECTED] wrote:
> what you do works on php5, not php4
> to make it work on both, you have to write the assignment like this:
>
> function startup(&$controller)
> {
> $this->controller = &$controller;
> }


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: First Bite notes data not shown

2007-01-10 Thread John David Anderson (_psychic_)


On Jan 10, 2007, at 11:37 AM, jvandal wrote:

>
> Hi,
> I am running the First Bite tutorial. I can see that the screen tells
> me it has found my mysql database "memo". I then create note.php (in
> models)and notes_controller.php (in controllers)that contain the
> scaffolding statements. I try to call notes data but I don't see any
> data as the tutorial shows.

How are you doing this?

> I look down in the folders aand I don't see
> any files created by the scaffolding statement. The scaffolding
> statement in Rails  produces the CRUD files. Isn't cakePHP  to  do the
> same?

It is, but scaffolding is purely software. Use the Bake utility to  
generate actually CRUD Ms Vs and Cs.

$php cake/scripts/bake.php

-- John


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: $content_for_layout data displaying after footer

2007-01-10 Thread John David Anderson (_psychic_)


On Jan 10, 2007, at 11:43 AM, milliseconds wrote:

>
> I have on layout where the $content_for_layout data is displaying  
> after
> the footer. Since I am new to Cake I am pretty sure this is a rookie
> error. How do I fix it?

We'd need to see your layout, but this is the basic idea. If you're  
still using the default layout at /app/views/layouts/default.thtml  
make sure it follows this basic pattern.





-- John

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



First Bite notes data not shown

2007-01-10 Thread jvandal

Hi,
I am running the First Bite tutorial. I can see that the screen tells
me it has found my mysql database "memo". I then create note.php (in
models)and notes_controller.php (in controllers)that contain the
scaffolding statements. I try to call notes data but I don't see any
data as the tutorial shows. I look down in the folders aand I don't see
any files created by the scaffolding statement. The scaffolding
statement in Rails  produces the CRUD files. Isn't cakePHP  to  do the
same?
Maybe I am not doing the right thing to execute the notes table ?
Any help will be appreciated
Jim


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



$content_for_layout data displaying after footer

2007-01-10 Thread milliseconds

I have on layout where the $content_for_layout data is displaying after
the footer. Since I am new to Cake I am pretty sure this is a rookie
error. How do I fix it?


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread NOSLOW

keymaster, I think that your problems may be related to how you have it
configured. I had the same problem with my primary key ("id" field)
getting deleted when I realized that I picked my tables in the wrong
order when setting up the relationship. Now that I got everything
working correctly, it's working out great for me.

Here are a few things to check:

1. Under Options-->Model Options-->Editing Options, make sure that "Add
Source Table Name to Foreign Key Column's Names" option is checked. (I
also have my Default Table Type set to "InnoDB", which enables me to
also check the "Automatically create Index on FK Fields in Destination
Table if ..." option).

2. From the toolbox, only use the "New 1:n Non-Identifying Relation"
and the "New 1:1 Non-Identifying Relation" buttons (the icons that show
a dotted line for the relations connection on the toolbar button).

3. The order you select the tables when defining the relations matters.
 CakePHP has 4 relation types: hasOne, hasMany, belongsTo and
hasAndBelongsToMany.  Only one of the four works counter-intuitively in
DBDesigner4, and that's when defining the "hasOne" relations.
Typically, you follow the order in how it reads: "ModelOne hasMany
ModelTwo" -- first click table "model_ones", then "model_twos". But for
"hasOne", it's backwards: "ModelOne hasOne ModelTwo" -- first click
table "model_twos", then table "model_ones".

4. After defining a relation, immediately edit it (double click on it)
and rename it to read the CakePHP way ("ModelOne hasMany ModelTwo",
note: you're using the model name convention, NOT the table name
convention here..."model_ones hasMany model_twos" would be wrong).
Then, (this is the only pain), you have to rename the Dest. Name
Foreign Key to follow the CakePHP convention of tablename-singular
(DBDesigner creates it as "model_twos_id", you want it to be
"model_two_id").

If you follow this configuration and conventions (thanks, Larry, for
showing us the way! study his model diagrams closely if you haven't
already), it should work out great for you. You'll see that it's a
breeze because DBDesigner will manage your foreign keys for you (you
just have to correct the naming of them to be singular). Thus, deleting
a relation will do the right thing and remove the correct FK, and not
the needed "id" field.

Good luck!


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread NOSLOW

RichardAtHome,

Does this work on Windows? The last I checked (within the past few
months) it did not (and  a google search confirmed that it was a well
known issue).


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread John David Anderson (_psychic_)


On Jan 10, 2007, at 10:29 AM, Matt Adams wrote:

>
> keymaster wrote:
>
>> A final question: how important are REAL foreign keys in the  
>> database,
>> if you are using cake associations. Are they superfluous? Are they
>> still needed?
>
> It depends on what you're doing.
>
> They are extremely important if your database offers read-write access
> to more than one application from the same set of tables.  A large
> majority of those who have swallowed the Rails-like pill have never
> worked with large-scale databases and do not understand the  
> necessity of
> enforcing integrity with foreign keys, triggers and stored procedures.

I've always had mixed feelings about this: in some ways using  
triggers, stored procedures and the like seem to me like spreading  
your application logic in too many places. I can see where they'd be  
useful though, too.

: /

> On the other hand, if your database isn't mission critical or if you
> only have one application accessing your core tables then you can do
> away with these sorts of things BUT you need to be certain that your
> application is enforcing any rules as need be.  A proper database will
> usually do these things much better than you will and I would hazard a
> guess that they contain fewer bugs then your application logic (or
> rather, that their bugs are better documented).

Just be sure your app knows how to deal with integrity failures.

> Some systems (as in Siebel and friends) do not use foreign keys but
> provide a set of integration tables that are used by external  
> systems to
> populate and manipulate the data in the core set of tables; these  
> tables
> are often handled by batch processes of some kind.
>
> I don't believe that Cake reads and understands foreign keys at this
> time... I would hope that this would be the case at some point but it
> may not happen for a while (or ever, depending on how the Cake
> developers feel about this).

I'd imagine its a little lower on the priority list, mostly due to  
the fact that different engines handle things so differently, but  
Nate and PhpNut will have to give the definitive answer on this one.

-- John

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread Matt Adams

keymaster wrote:

> A final question: how important are REAL foreign keys in the database,
> if you are using cake associations. Are they superfluous? Are they
> still needed?

It depends on what you're doing.

They are extremely important if your database offers read-write access 
to more than one application from the same set of tables.  A large 
majority of those who have swallowed the Rails-like pill have never 
worked with large-scale databases and do not understand the necessity of 
enforcing integrity with foreign keys, triggers and stored procedures.

On the other hand, if your database isn't mission critical or if you 
only have one application accessing your core tables then you can do 
away with these sorts of things BUT you need to be certain that your 
application is enforcing any rules as need be.  A proper database will 
usually do these things much better than you will and I would hazard a 
guess that they contain fewer bugs then your application logic (or 
rather, that their bugs are better documented).

Some systems (as in Siebel and friends) do not use foreign keys but 
provide a set of integration tables that are used by external systems to 
populate and manipulate the data in the core set of tables; these tables 
are often handled by batch processes of some kind.

I don't believe that Cake reads and understands foreign keys at this 
time... I would hope that this would be the case at some point but it 
may not happen for a while (or ever, depending on how the Cake 
developers feel about this).


Cheers,

Matt
-- 
BASIC: A programming language.  Related to certain social diseases
in that those who have it will not admit it in polite company.

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: accessing a controller from a component.

2007-01-10 Thread [EMAIL PROTECTED]

what you do works on php5, not php4
to make it work on both, you have to write the assignment like this:

function startup(&$controller)
{
$this->controller = &$controller;
}


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread John David Anderson (_psychic_)


On Jan 10, 2007, at 3:49 AM, Ryan Snowden (Beijing) wrote:

> Maintenance of code in the bakery will suffer the same problems of  
> depreciation, but easily controlled through an admin panel addition  
> "unpublish reason depreciated" which can contact the author, place  
> a notice, or be dugg down by viewers for admin attention.

Content in the Bakery is also tagged by version. It's actually meant  
to get old gracefully. You know its old, because you see that its  
labeled 0.9x or 1.1x, etc.

The wiki was a festering pit of misinformation. I cannot say that  
enough. Sure, there were a few articles that were good, but on the  
whole, it was a horrible source of problems. As the documentation  
lead, and someone that takes on support in the IRC channel most of  
the day, I can say–without doubt–the axing of the wiki is a most  
wonderful thing.

> From a new user starting up cake POV, if you see the wiki and the  
> main site, it seems less integrated and has the impression of an  
> incomplete framework.  I know when I was hunting, it somewhat  
> deterred me, compared to the fruity pages of ROR (without a manual).
>
> Now it's here, and here to stay, so perhaps the addition of those  
> most needed tutorials that seem to be popping up can be added with  
> an updated revision.  I'm sure Mr Anderson (psychic) could use the  
> help even from hypocrites like yours truly ;)

Dude. Mister Anderson is my father.

Well said otherwise, though. :)

The Bakery is most definitely the vision for the future. It allows  
the community to contribute (like the wiki did) but it allows us to  
verify the quality of the content, and store it in a way that will  
get old gracefully.

The only drawback with the Bakery is the lull in content. The wiki  
had some good stuff (somewhere, I suppose), and there will be some  
growing pains that result from not having it around. But, it is  
community contributed, and we still have the ghost of the wiki in  
Google cache for a while. Jump in and move things you think are cake- 
worthy.

The Bakery will only get better (while the wiki would have only  
gotten worse).

-- John


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread RichardAtHome

Another (minor) problem with the otherwise excellent DBDesigner is that
it uses MySQL old passwords. This means that once you create your MySQL
User, you then need to run the following sql before you can connect
with DBDesigner:

SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

Also worth noting: DBDesigner is no longer actively developed. It's
functionality is being incorporated into the MySQL GUI tools. Check out
the MySQL Workbench tool (
http://dev.mysql.com/downloads/gui-tools/5.0.html )


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



accessing a controller from a component.

2007-01-10 Thread phpjoy

i think i'm missing something in my component, .. i can't seem to
access the controller from the component.

here's the component's code:

class PlacesComponent extends Object {
var $controller = true;

function startup(&$controller) {
$this->controller = $controller;
}

function Do() {
$this->controller->redirect('/admin/center/');
}
}

in the controller I use the following code:
loadComponent('Places');

the error I'm getting in the browser:
Fatal error: Call to a member function redirect() on a non-object in
{filename}

it seems as if it giveme access to $this->controller from the startup
function. I tried it without the startup function, and couldn't find
anything about it in the API.
i'd be happy to know how come it doesn't work, and where i could find
it in the API itself.. .. 


I use cake 1.12.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: International PHP Magazine Poll:Best PHP Framework

2007-01-10 Thread Samuel DeVore

So isn't the framework called Symfony???
http://www.symfony-project.com/  how valid can a poll be if it gets
the names wrong, or how authoritative is the mag?  Now they did get
CakePHP right, and as a list we know what the killer framework is

On 1/10/07, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> Congratulations to everyone responsible for making CakePHP happen!
>
> http://www.php-mag.net/magphpde/magphpde_news/psecom,id,26752,nodeid,5.html
>
> 'CakePHP' has beaten all its competitors with a majority of 78.5%
> votes taking home the title of the best PHP MVC Framework. Next in line
> is 'Sympony' with 10.9 %votes.WACT, Achievo, PHPonTrax was last on
> the list as three of them garnered a dismal 0.0% votes each.
>
>
> >
>


-- 
==
S. DeVore
(the old fart) the advice is free, the lack of crankiness will cost you

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-10 Thread keymaster

DBDesigner is  great in some ways, but a real pain in others.

For example, if you create a A hasMany B relationship, it creates a
foreign key for you in B. That's fine. But it makes that foreign key
part of a composite primary key for table B. Don't understand the
reason for that.

The problem is if you have a B hasMany C relationship, it creates two
foreign keys in table C, one for each part of the composite key in B.

Another issue, if you ever have to delete a relationship because you
accidentally input it in reverse and want to change it's direction, you
could end up deleting the primary key in one of the tables. And the
effect ripples to all other tables which may have foreign keys to that
table.

So, one small mistake can cause you lots of cleanup work.

I wasn't happy about that aspect. It's enough to prevent me from using
it with cake.

A final question: how important are REAL foreign keys in the database,
if you are using cake associations. Are they superfluous? Are they
still needed?


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



International PHP Magazine Poll:Best PHP Framework

2007-01-10 Thread RichardAtHome

Congratulations to everyone responsible for making CakePHP happen!

http://www.php-mag.net/magphpde/magphpde_news/psecom,id,26752,nodeid,5.html

'CakePHP' has beaten all its competitors with a majority of 78.5%
votes taking home the title of the best PHP MVC Framework. Next in line
is 'Sympony' with 10.9 %votes.WACT, Achievo, PHPonTrax was last on
the list as three of them garnered a dismal 0.0% votes each.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Ajax in IE, not calling subsequent actions

2007-01-10 Thread igor

I have a AJAX call in my view. It is a observer, and where it is
onLoaded, it call another two Ajax.Updater-s to update some divs.
This is working in Firefox, but in IE6 it is not calling these two
Ajax.Updater-s but the obeserver itself is doing a job (DB got
changed).

In controller I use RequestHandler->setAjax($this) so the respond got
back with UTF-8 header... (I see other ppl point that out, but it's not
that, AFAIK)

Please see the code below.

Filter:




Event.observe("update_button", 'click', function(event){
new Ajax.Updater('update_topics','/insert_panel/editors/update_topics',
{
onLoading:function(request){$('update_topics').innerHTML = ' updating...'; new
Effect.Appear($('update_topics'));},

onLoaded:function(request){$('update_topics').innerHTML =
'updated'; new Effect.Fade($('update_topics'),20);
  new Ajax.Updater({success:'available_topics'},
'/insert_panel/editors/available_topics', {asynchronous:true,
evalScripts:true, parameters:Form.serialize(Event.element(event).form),
requestHeaders:['X-Update', 'available_topics']});
  new Ajax.Updater({success:'assigned_topics'},
'/insert_panel/editors/assigned_topics', {asynchronous:true,
evalScripts:true, parameters:Form.serialize(Event.element(event).form),
requestHeaders:['X-Update', 'assigned_topics']});},

asynchronous:true, evalScripts:true,
parameters:Form.serialize(Event.element(event).form),
requestHeaders:['X-Update', 'update_topics']}) }, false);


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: More than one DB per application

2007-01-10 Thread ms

Oh great!!!
Thanks alot Grant


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Admin Controller

2007-01-10 Thread Justin Johnson

If this is going to be the only action in the controller, then I would
use the pages controller.

simply add an admin() function in the pages controller and use the
following route

$Route->connect('/admin', array('controller' => 'pages','action' =>
'index'))


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Advises before being in production

2007-01-10 Thread francky06l

Hi All,

I have written a B2B application that should go live in 3 weeks. So I
was wondering what advises, what to check before this important step.

Some details :
- each user needs authentication (not using ACL built in)
- every request is checked against the user authentified (except
signing in of course)
- I use lot of  Ajax and I accept only POST (few exceptions)
- I have tuned quite a lot for performances (mainly on DB, suing a lot
of bindModel / unbindModel and the excellent useModel (found on
RossSoft) )
- I will turn the debug mode to 0
- this is not a "public" application, but security is important .. so
what else to consider ?
- the application is multi langage (2), and I had to tweak the ajax
helper because UFT8 in ajax answer did not appear correct, not a
problem now..

My biggest concern is concerning encryption, Indeed this application
will be hosted in a Balkan country where the hosting company or their
employee tend to "sell" data by their own. So I was considering
encryption, I can do this but if the key is into the application ..well
..too easy to crack.
Maybe writing a php extension, but I have no time for this now ..

So thanks to everyone, thanks to CakePhp .. I promise a donation as
soon as it's live for few days !!!

Any comments, advises, ideas are welcome ..
Thanks again


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Simplify foreach() - unpleasant array

2007-01-10 Thread Grant Cox

Except that in this case the array is $reservations[ {n}
]['Reservation'] .  You should only have ['Reservation'][ {n} ] when
that Reservation model is loaded indirectly through an associated
hasMany - ie where Person hasMany Reservation (recursive 1)

$people = Person->findAll()  gives:
$people[ {n} ]['Reservation][ {n} ]


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: More than one DB per application

2007-01-10 Thread Grant Cox

The app/config/database.php can define any number of database
connections - the $test connection is just there as an example.  So,
define whatever other ones you want (with any variable name), then use
that variable name in your model, with var $useDbConfig.

app/config/database.php
var $emails = array('driver' => 'mysql','connect' =>
'mysql_connect','host' => 'localhost','login' => '','password' =>
'','database' => 'my_app');

in app/models/post.php
var $useDbConfig = 'emails';


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread Ryan Snowden (Beijing)
Maintenance of code in the bakery will suffer the same problems of  
depreciation, but easily controlled through an admin panel addition  
"unpublish reason depreciated" which can contact the author, place a  
notice, or be dugg down by viewers for admin attention.

 From a new user starting up cake POV, if you see the wiki and the  
main site, it seems less integrated and has the impression of an  
incomplete framework.  I know when I was hunting, it somewhat  
deterred me, compared to the fruity pages of ROR (without a manual).

Now it's here, and here to stay, so perhaps the addition of those  
most needed tutorials that seem to be popping up can be added with an  
updated revision.  I'm sure Mr Anderson (psychic) could use the help  
even from hypocrites like yours truly ;)

The snippets form CakeForge needs removing too, these can now go in  
the bakery, but there is still some good stuff in there that works.   
I imagine that will be going next ;)

-- 
北京点晶科技


On Jan 10, 2007, at 5:11 PM, green-mamba wrote:

>
> I DO realise a lot of the stuff is now obsolete, but I still think  
> that
> it is a case of throwing out the baby with the bathwater
>
>
> >



--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---


Re: Container for models,controllers,... -> "extensions"

2007-01-10 Thread [EMAIL PROTECTED]

> Just to add my last 2ps to the idea - I was wondering along these
> lines not for providing generic extensions but  for preventing feature
> bloat in specific applications.

To me it is about having (reusable) sources available in a flexible way
(like "libraries" in most languages, except that in this case cake core
doesn't have to search through the "libraries", it can immediately find
what it needs if we implement a few conventions )

one of the side-effects of extensions would be that more specific
featuresets end up in specific extensions (if you want that, if you
don't that's fine too ofcourse )
So if that's your only goal, you could use it just fine for that too ;-)


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread D.Pape


> On 1/10/07, RichardAtHome <[EMAIL PROTECTED]> wrote:
>   
>> I found the following tutorial very helpful:
>>
>> http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html
>>
>> (if free to view, but requires registration - check out the other two
>> parts too)
>> 
>
> +1
>
> Now there are three more parts - the 4th was released very recently
>
> Tarique
>   

Here´s some links to the great tutorial (WITHOUT registration!):

Part 1:
https://www6.software.ibm.com/developerworks/education/os-php-cake1/os-php-cake1-a4.pdf

Part 2:
https://www6.software.ibm.com/developerworks/education/os-php-cake2/os-php-cake2-a4.pdf

Part 3:
http://www-128.ibm.com/developerworks/library/os-php-cake3/index.html

Part 4:
https://www6.software.ibm.com/developerworks/education/os-php-cake4/os-php-cake4-a4.pdf


Cheers, Daniel

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread Dr. Tarique Sani

On 1/10/07, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> I found the following tutorial very helpful:
>
> http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html
>
> (if free to view, but requires registration - check out the other two
> parts too)

+1

Now there are three more parts - the 4th was released very recently

Tarique
-- 
=
PHP Applications for E-Biz: http://www.sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Container for models,controllers,... -> "extensions"

2007-01-10 Thread Dr. Tarique Sani

On 1/10/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Some additions to the above

Just to add my last 2ps to the idea - I was wondering along these
lines not for providing generic extensions but  for preventing feature
bloat in specific applications.

Cheers
Tarique


-- 
=
PHP Applications for E-Biz: http://www.sanisoft.com
Cheesecake-Photoblog: http://cheesecake-photoblog.org
=

--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread RichardAtHome

I found the following tutorial very helpful:

http://www-128.ibm.com/developerworks/edu/os-dw-os-php-cake1.html

(if free to view, but requires registration - check out the other two
parts too)

Got me over the initial learning hump and well on the way to producing
a 'real' application.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread green-mamba

I DO realise a lot of the stuff is now obsolete, but I still think that
it is a case of throwing out the baby with the bathwater


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Simplify foreach() - unpleasant array

2007-01-10 Thread RichardAtHome

Grant Cox wrote:

> Using $reservation['Reservation']['number'];  is correct.  This is
> because each retrieved row may have associated models - ie
> $reservation['Room'] etc.

Ah, another chink of sunlight just broke through the clouds :-)

I was going to ask this same question myself. My workaround (for models
with no associated models was to do the following:

$tmp=$reservations['Reservation'];

foreach($tmp as $reservation) {

  echo $reservation['number'];

}


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread [EMAIL PROTECTED]


> Why, oh why, did they just take the Wiki down. There were a LOT of
> useful stuff on there

because much of the content is deprecated.

although the "beginners only tutorial" was indeed a very good one, it
was the one that helped me most (by far) when i began with cake


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread green-mamba

Nevermind!

I read a post on here about getting old pages out of Google Cache and
that is exactly what I did.

I still don't trust the Bakery though. I just don't seem to get results
back for my searches

Why, oh why, did they just take the Wiki down. There were a LOT of
useful stuff on there

Christine


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Beginners Only Tutorial that was on the WIKI

2007-01-10 Thread green-mamba

Hi,

I have a friend who wants to start learning CakePHP and I remember when
I started that the beginners only" tutorial on the Wiki was actually
very nice to start off with.

Seeing that the wiki has now disappeared (g), does anyone have this
tutorial lying around somewhere and can possible email it to me? It
will be greatly appreciated.

And is it only me - but I can't find stuff on the bakery! I don't mean
the stuff is not there (I know large chunks are not there) but if I
look for anything I either get 0 results or I get all the articles,
relevant or not. 

Regards
Christine


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



More than one DB per application

2007-01-10 Thread ms

Hello everybody,
how can I use more DBs per application? Configuring Cake I created a
database.php (in app/config), but here there's the possibility to place
one production and one test DB. but my project needs to have more than
on DB (one for users, one for tickets, one for forum and so on; every
db should be a controller, but all starting from a main index action
[home page of the site]). So here I configure all this?
Thanks!!!


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Container for models,controllers,... -> "extensions"

2007-01-10 Thread [EMAIL PROTECTED]

Some additions to the above

with this method you could use *all* classes in an extension  to
inherit from in your app. (as long as they obey the conventions)

Also, you could "directly" integrate components,models,helpers,.. from
an extension like $uses=('CoolCakeUser','Post') in your app.
For controllers however we would need to add some functionality to the
cake core, so that it - just like in the way it can "recognize" when it
deals with extensions based on the proper classname and the $extensions
variable - would directly open the controller in the extension
directory, when you call an action like mysite.com/coolcake/users/index

Same goes for views.  the cake core like it is now isn't prepared for
views residing in an extension, i would fix this by calling them by
$this->render('coolcake/users/view'); so that it can (again) simply
recognize you're dealing with an extension (based on the fact that you
use more then 2 things between slashes, and the first one happens to be
a string that "happens to be" in your $extensions array ;-) and open
the right file.


In conclusion:
advantages:
1) no performance hit ( i checked how cake core handles
$controllerPaths, working like that needs more filesystem calls then
this method)
2) easily swapping in/out/updating of 3rd party code/library
2 bis) ability to work with svn:externals
3) separation between code that is meant to do a specific thing
3) using 3rd party code like if it was inside your app (use them
directly or inherit from them)

disadvantages:
1) could impose conflicts in naming.  But when you download code from a
3rd party and integrate them in your app, you have the same issues.  I
proposed a solution for this which means your classnames will become a
little longer, but very recognizable for php code in the cake core.
This also requires a certain "discipline" of the 3rd party author (to
choose a unique name for an extension for example), discipline that is
otherwise a bit more neglected.  We now have classes on the bakery
called "mailercontroller" , "protectorcomponent" or "userscontroller".
(i'm guilty of that last one) just to name a few.  All classes that are
meant to be put in app directly, which gives a high risk of duplicate
classes .  with the proposed conventions i think this would improve a
great deal.
2)fixing bugs that could be at several locations will be harder.
(..but writers of extensions shouln't release buggy code offcourse ;-)


obviously, my opinion is biassed, i really like my own idea.  It woud
be great if i could convince cakephp devs to implement this, but if
don't... they probably have their reasons ;-)  Although then i would
really like to hear those reasons.

 if you guys think this idea is _not_ good, please explain why, i want
to think further about this, propose ideas and discuss.
If there is a solid argument about why this isn't good, i'll shut up
and be very glad i learned something.


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Need help with linked tables

2007-01-10 Thread Tony Lambiris

Nevermind, I got it working. game.php was actually named
games.php... sorry for the noise!


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---



Re: Need help with linked tables

2007-01-10 Thread AD7six



On Jan 10, 8:38 am, "Tony Lambiris" <[EMAIL PROTECTED]> wrote:
> The way my app works is I have three tables: users, systems and games.
>
> users relates to systems
> systems relates to games
> users does not relate directly to games
>
> When I am in my User controller, I want to be able to issue a command
> like this:
> $this->User->System->find("ps3")
> and have it return a list of games based off PK systems.id (which
> equals games.system_id).
>
> In my models (user.php, system.php and game.php), I have the following
> (respectively):
>
> class User extends AppModel {
>   var $name = 'User';
>   var $hasMany = array('System');
>
> }class System extends AppModel {
>   var $name = 'System';
>   var $hasMany = array('Game');
>   var $belongsTo = array('User');
>
> }class Game extends AppModel {
>   var $name = 'Game';
>   var $belongsTo = array('System');
>
> }When I try to access my User controller, I get the error:
>
> Fatal error: Class 'Game' not found in
> /vhosts/site/cake_1.1.12.4205/cake/libs/model/model_php5.php on line
> 438
>
> Any ideas? Im kinda new to the MVC world, so it's kind of confusing to
> me. I read some where scaffolding helps sort these out visually.
>
> TIA.

Hi Tony,

Your game model file is present but the class within it is either
misspelt or otherwise not declrared.

HTH,

AD7six
Please note:
The manual/bakery is a good place to start any quest for info.
The cake search (at the time of writing) erroneously reports less/no
results for the google group.
The wiki may contain incorrect info - read at your own risk (it's
mainly user submitted) :) You may get your answer quicker by asking on
the IRC Channel (you can access it with just a browser
here:http://irc.cakephp.org).


--~--~-~--~~~---~--~~
 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?hl=en
-~--~~~~--~~--~--~---