Re: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

Samuel DeVore wrote:
> I wonder if some kind of model extension could be proposed by people
> who are deeply involved in the use of views in their database
> environments, one that could create a mapping from what a view returns
> to what it would equate to in cakephp constructed style model queries.
>  That could then be used to create the CakePHP style of results
>   
That's where my limited knowledge of the classes used by Cake does not 
help me:  For me, a query on a view return a dataset, just like a query 
on a table. They are not different at all, in that regard.

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

ralph
> And Bernard, I actually enjoy admitting that I don't understand 
> everything. That gives me a chance to learn something new. Learning is 
> one of the greatest pleasures in my life, and I would feel deprived 
> without it. As a result, I have a powerful and continuing need for 
> significant quantities of my own ignorance. Fortunately, I haven't 
> come close to running out yet.
>   
There are a lot of things I don't know and/or don't understand, be it 
about PHP, SQL, or female psyche, and I love to learn too. I was simply 
disturbed by the affirmation that, because one has never used a specific 
feature, that feature had no use and/or "raison d'etre".

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

Jeff
> Be warned that you have to be explicitly clear in aliasing your complex 
> queries, or Cake will not know what to do.
>
> SELECT User.first_name, User.last_name FROM users User
>
> If you're using SQL functions, don't forget to alias those as well... 
> The aliases are the foundation to RDBMS -> ORM mapping in this 
> implementation..
>   
Will remember that, thank you.

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

Chris
> Um, I never said I was a DBA or looking to work as a DBA. I've never
> been discounted from a position as a developer because I didn't know
> what a view was or how to use it.  And on top of it, you continue to
> be incredibly rude towards me.  Your little joke about exposure to the
> sun is a perfect example of that.
>
> Do all DBA's have this type of attitude towards developers?  Wow.
> Oddly enough, the other DBA that I have worked with displayed the same
> level of disdain for developers and shock that not everyone understood
> database systems the way he did.  He wasn't even that good at his job
> either.
>   
I am sorry if my tone was rude, I was simply trying to say that to never 
had the opportunity to ever create and/or use a view, in 9 years of 
experience , (or 20, for that matter), is not good enough of a reason to 
discard their use.

I am a programmer, and never had a position as a DBA. It might surprises 
you, but it's true. I develop client applications, or, more exactly, 
help other programmers (all my clients are programmers) to develop or 
improve their applications. And, very, very often, my job is to open 
their eyes on SQL, as they  upgrade their applications from Sequential 
ISAM files to SQL.
Problem is, generally speaking, they continue to program with the same 
ISAM mindset, which is far from optimal. As an example, I have recently 
wrote ONE stored procedure, replacing 3 "process", with the result to go 
from about 1 hour of heavy processing on their machine, to about 0.30 
second on the Postgresql server. ( Not comparing with MySQL, as before 
version 5, this was impossible in MySQL).

So, I am a programmer, like you. I have been developing applications 
(Desktop and Lan) for businesses of all sizes, and now my experience 
allow me to work in the background, for other programmers. I am mostly a 
beginner in PHP, and have a lot too learn in that field, which I admit 
very easily. But I am learning. And if I manage to learn to the point 
where I would be able to help modify Cake core classes, I will be very 
happy to do so. But for now, I was mostly pointing out that, discarding 
the ability to use back end views was a disturbing choice for me.

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

Jeff Loiselle
> You have to follow convention if you want Cake to play with you
>
> Try this:
>
> CREATE VIEW users_profile_view AS
> SELECT
>   User.id as UserProfileView.id,
>   User.username as UserProfileView.username,
>   DATE( User.last_login ) as "UserProfileView.last_login",
>   User.city as "UserProfileView.city",
>
>
> etc.
>
> If that doesn't work let me know. Usually if you alias everything it 
> should work perfectly. If not, you can use the raw dbo methods for 
> query and retrieval.
>   
Good advice, thanks, will try.
Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

Larry E. Masters aka PhpNut wrote
> Get this thread back on topic or I will close it 
OK, sorry.
Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

Larry E. Masters aka PhpNut wrote:
> No one will be banned from the list unless I do it, and that happens 
> only when I feel someone has pushed me to do it.
>  
Thanks you.
Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

AD7six wrote:
> How about just using the method rawQuery (or whichever is the lowest 
> common-denominator model query method)? 

Don't know, I am not a specialist in Cake, but so far I have been unable 
to create a controller on a view (backend view, I mean). And I have not 
tried either to have one working on a stored procedure returning a 
dataset, 2 very common ways to develop an application working with a 
relational database. (Some stored procedures are just a view with a 
parameter)

Bernard

--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

AD7six wrote:
>> That's a pretty typical (and kinda sad) answer from someone with no real
>> sql/ database background, and happy with MySQL...
>> 
>
> BTW Please keep it friendly ;).
>
>   
Sorry it came out too strong. English is not my mother tongue, even if i 
had a good "exposure" to it (pun very much intended!), and from the 
reactions I can see I should have started that on a lighter tone.

Bernard



--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

Chris
>  You're probably right that
> 9+ years of exposure to MySQL, Postgres and some Oracle mixed in there
> as well gives me no real sql/database background. 
>   
Exposure? Sorry, what do that mean? I have been exposed to the sun, 
quite a bit, that did not give me any specific insider informations 
about how it works...
Never used views, he? How many databases have you DESIGNED, from 
scratch? How many times have you been chief of a project, responsible  
entirely, from A to Z, for data integrity, security, as well as defining 
stored procedures, triggers, etc, etc

If I was looking for a job as DBA, I would avoid to put on my resume 
that I have no ideas what views are made for

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-29 Thread Bernard Grosperrin

nate
>  No more MySQL-bashing or Postgres arrogance. 

Arrogance? Which one? Comparing apples and oranges has never been a fair 
comparison. If you want pure raw speed, the old Btrieve files have no 
real match.
You request in Postgresql is slow? Are you sure it's used properly?

You can ban me from this list, I have no problem with that. But about 
arrogance, check yourself in a mirror.

Bernard



--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-28 Thread Bernard Grosperrin

Kaste
> when you dont need the modelling-features of a framework because it  
> duplicates your fine SQL-code and you only see a need for the VC of the  
> MVC probably switch to CodeIgniter and query your views and execute your  
> procedures and do the validation in the controller.
>   
I have been overlooking CodeIgniter. Will look deeper at it. I am not a 
"cake" in PHP (pun intended!), but am pretty good at SQL, and use it 
daily to solve business problems. so it's very natural for me to want to 
code on that side, and want the web pages to do the display, and that's 
about it. And I want a framework to not have to reinvent the wheel when 
I need users to login, for example.

But I don't want to be constrained by the Framework, on the contrary

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: ER Tools

2007-01-28 Thread Bernard Grosperrin

codecowboy wrote:
>   2 They cannot export the diagrams (typically they can 
> export anything but MySQL 5!!). 

makes a lot of sense. Before 5, Mysql knew nothing about entity relations.

Bernard

--~--~-~--~~~---~--~~
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: [professionel] Re: OT - Q for PHPNut on DBDesigner 4 - Was: ER Tools

2007-01-28 Thread Bernard Grosperrin

John
> 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.
>   
No. ALL the business logic should be where it belongs, with the data 
(Think OOP, where is the logic?)
Your application is a "view", a "client". That's it. You should not have 
any business logic there. Data entry validation, sure, as it makes for a 
better user interface (still, the database should check for this too)

> Just be sure your app knows how to deal with integrity failures.
>   
Can't. Only the DB knows about transactions, COMMIT and ROLLBACK.

> 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.
>   
No. DB engines handle things differently INTERNALLY. The interface is 
the same. Right now, Cake works with PostgreSQL as well as with MySQL 
(and maybe others).
The simple fact is that a MySQL background is not the proper way to get 
a good SQL background.

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Cake is breaking database views. This looks like a bug.

2007-01-28 Thread Bernard Grosperrin

Chris
> I have never used an SQL view and would love to see a real-world
> example of when a view should be used over, say, the CakePHP model
> combined with associations.
>
>   
That's a pretty typical (and kinda sad) answer from someone with no real 
sql/ database background, and happy with MySQL, which just recently, 
(version 5) realised that Views, stored procedures, triggers, etc are 
MANDATORY in any serious database engine.( I use Postgresql exclusively 
with Cake, and am increasingly frustrated by the numerous limitations of 
cake versus a REAL database)

Let's see some REAL WORLD reasons to use views instead of (or beside) 
associations in cake:
(1) The request is compiled in the DB engine instead of being 
interpreted each time. So optimization is done once and for all, hence 
faster, and results can be cached. So the first reason is performances.
(2) Security, at different levels. Guest use can access views, or some 
views, and none of the underlaying tables.
(3) Technicals reasons. The association have no ideas on how to handle a 
recursive relation. Example:

SELECT a.suppliesactivityid, a.suppliesid, a.pending, a.date, a.qtyin,
a.qtyout, a.productid, (
SELECT sum((sua.qtyin - sua.qtyout)) AS sum
FROM sua
WHERE ((sua.suppliesactivityid <= a.suppliesactivityid) AND
((sua.suppliesid)::text = ((
SELECT suaview_id.suppliesid
FROM suaview_id
WHERE (suaview_id.id = 1)
))::text))
) AS qtyonhand, a.setasbeginningbalance, a.tagged, a.seqno
FROM sua a
WHERE ((a.suppliesid)::text = ((
SELECT suaview_id.suppliesid
FROM suaview_id
WHERE (suaview_id.id = 1)
))::text)
ORDER BY a.pending, a.date, a.suppliesactivityid;


It's a running total, very classical SQL. There are no other ways than a 
query in Cake. But it's a typically slow query. Using a view for this is 
THE way to do it.

Justifying limitations in a product by doubting the usefulness of very 
standard SQL features is not giving confidence in the futures 
ameliorations to said product.
In other words, I don't like this answer, it makes me doubt of my sanity 
in spending time with cake.

Bernard

--~--~-~--~~~---~--~~
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: [professionel] Re: Pagination Problem

2006-12-13 Thread Bernard Grosperrin

Dateve,

I am working on the same thing, but am certainly more of a beginner than 
you are.
What is this Pagination object?

Is this the component from ad7six on cakeforge?
I guess I am dumb enough I need a step by step (typing slowly, so that I 
can follow) explanation.

Thanks for this post, it helps a lot, actually!

Bernard
> Thanks for your help! With your assistance I solved the problem.
>
> For those of you that might encounter the same Cake Pagination Problem,
> this is how I fixed it:
>
> My Controller:
> ---
>   /**
>* Index Action.
>*/
>   public function index($criteria = NULL) {
>
> $this->pageTitle = 'Throbbin Hood :: Porno for the masses since
> 1853';
>
> // If we JUST clicked the search button
> if(isset($this->data['form']['search'])) {
>
>   // Let's clean our search
>   uses('sanitize');
>   $toiletDuck = new Sanitize();
>   $cleanDuck = $toiletDuck->sql($this->data['form']['search']);
>
>   // Redirect to ourself with the new with new parameters
>   $this->redirect('passwords/index/'.$cleanDuck);
> }
>
> // If we were redirected from ourself with new parameters
> if($criteria) {
>   $search_value = $criteria;
>   $criteria = array('Password.url' => "LIKE %{$search_value}%");
> }
>
> // Initialize the pagination object, get results from the database,
> and set it for the view
> list($order, $limit, $page) = $this->Pagination->init($criteria);
> $passwords = $this->Password->findAll($criteria, NULL, $order,
> $limit, $page);
> $this->set('passwords', $passwords);
>
> // Tell it what page to view.
> $this->render('index');
>   }  
> --
>
> 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
-~--~~~~--~~--~--~---



Error after upgrading to 1.1.11.4064 on new ModelName()

2006-12-07 Thread Bernard Grosperrin
I just upgraded to the last version, and get an error I don't understand:

*Fatal error*: Class 'Location' not found in 
*C:\ApacheSSL\htdocs\cake\app\controllers\components\choose_location.php* 
on line *12

*here is the code in choose_location:*
*
** class ChooseLocationComponent extends Object
{
   var $controller = true;  
   // I have to find a way to have a function here which can receive 
parameters(or not)
   // and would find only the locations for the current user
 
   function startup (&$controller)
   {
   $this->controller = &$controller;
   $Location = new Location;
   $data = $Location -> findAll();
   $this->controller->set('ChooseLocation',$data);
   $Category = new Category;
   $my_data = $Category->findAll();// now you are able to do 
this
   $this->controller->set('category_list', 
$my_data);  
   }   
   
}

Location is a model, and this was causing no problems with the previous 
version I was using (noted in the files as revision 1.1, 2006/08/09 
14:48:55.
I read this note : "The change results in a need to make sure you 
loadModel('ModelName'); if you use $ModelName = new ModelName() 
somewhere in your code. We have seen several examples, particularly in 
reference to components creating model instances. This was not 
recommended practice, so remember that you need to load the model now if 
you plan on creating an instance."

But when I change the above code to read:

class ChooseLocationComponent extends Object
{
   var $controller = true;  
   // I have to find a way to have a function here which can receive 
parameters(or not)
   // and would find only the locations for the current user
 
   function startup (&$controller)
   {
   $this->controller = &$controller;
   loadModel('Location');
   loadModel('Category');
   $Location = new Location;
   $data = $Location -> findAll();
   $this->controller->set('ChooseLocation',$data);
   $Category = new Category;
   $my_data = $Category->findAll();// now you are able to do 
this
   $this->controller->set('category_list', 
$my_data);  
   }   
   
}

I get the very same error, line 14 instead of 12, logic!
Is there something in the configuration I should have taken care off, 
somewhere, or is my code not making sense?

For now, I have simply changed back CAKE_CORE_INCLUDE_PATH, as cake is 
in his own C:\cake directory, while app is under Apache\htdocs.

Thanks for you help,
Bernard


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---


Pagination with search

2006-11-15 Thread Bernard Grosperrin

OK, I guess I don't know enough to do what I want to, so I am running 
around in circles.

I have a view, with a form sending request parameters to the same view.
Works fine, build my query and display results OK.

BUT, if I have more than one page of results, a click on next page, as 
it call the page without data, reset my search!
So, is there a way to save those data?

In fact, I am guessing that I am asking how to save a variable between 2 
calls to the same function. Should I use session for that, or is there 
another way?

Thanks,
Bernard

--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Retrieve URL - New thread.

2006-11-13 Thread Bernard Grosperrin

I would like to improve my rather crude login system. For now, after 
login, I redirect the user to '/', or the "Home" page.
I would like to "trap" or retrieve the URL the user intended to go to, 
pass it as parameter to my login function, to redirect to this URL 
instead of Home.
Is there a way to do this, or should I write a "checkSession" with 
parameter, which would be the URL from where it is called? (which I tried and 
does not seems able to make it work.)

Thanks,
Bernard


--~--~-~--~~~---~--~~
 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: [professionel] RE: Retrieve URL?

2006-11-13 Thread Bernard Grosperrin

Mariano Iglesias wrote:
> Please post this message on its own thread. I have a possible solution but
> it wouldn't be polite to the other readers of this thread to completely
> change the subject this thread was about.
Sorry, did not realize I did that!~~-
Bernard


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Retrieve URL?

2006-11-13 Thread Bernard Grosperrin


I would like to improve my rather crude login system. For now, after 
login, I redirect the user to '/', or the "Home" page.
I would like to "trap" or retrieve the URL the user intended to go to, 
pass it as parameter to my login function, to redirect to this URL 
instead of Home.
is there a way to do this, or should I write a "checkSession" with 
parameter, which would be the URL from where it is called?

Thanks,
Bernard

--~--~-~--~~~---~--~~
 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: [professionel] Mysteries with findAll ???

2006-11-07 Thread Bernard Grosperrin

As an answer to myself, further tests with postgresql let me see that I 
need to replace the first left join by an inner join
> SELECT "Stock"."product_id" AS "Stock__product_id", 
> "Stock"."location_id" AS "Stock__location_id", "Stock"."on_hand_units" 
> AS "Stock__on_hand_units", "Stock"."committed_units" AS 
> "Stock__committed_units", "Stock"."on_order_units" AS 
> "Stock__on_order_units", "Stock"."on_hand_dollars" AS 
> "Stock__on_hand_dollars", "Stock"."exch_cost" AS "Stock__exch_cost", 
> "Stock"."last_exch_cost" AS "Stock__last_exch_cost", "Stock"."created" 
> AS "Stock__created", "Stock"."modified" AS "Stock__modified", 
> "Product"."id" AS "Product__id", "Product"."description" AS 
> "Product__description", "Product"."size_description" AS 
> "Product__size_description", "Product"."section_size" AS 
> "Product__section_size", "Product"."aspect_size" AS 
> "Product__aspect_size", "Product"."tire_rim_size" AS 
> "Product__tire_rim_size", "Product"."plg_type" AS "Product__plg_type", 
> "Product"."speed_rating" AS "Product__speed_rating", 
> "Product"."load_rating" AS "Product__load_rating", "Product"."side_wall" 
> AS "Product__side_wall", "Product"."created" AS "Product__created", 
> "Product"."modified" AS "Product__modified", "Location"."id" AS 
> "Location__id", "Location"."name" AS "Location__name", 
> "Location"."opensunday" AS "Location__opensunday", "Location"."created" 
> AS "Location__created", "Location"."modified" AS "Location__modified" 
> FROM "stocks" AS "Stock" LEFT JOIN "products" AS "Product" ON 
> "Stock"."product_id" = "Product"."id" LEFT JOIN "locations" AS 
> "Location" ON "Stock"."location_id" = "Location"."id" WHERE 
> "Product"."section_size" = 265 AND "Product"."aspect_size" = 70 LIMIT 100
>   
as in

INNER JOIN "products" AS "Product" ON "Stock"."product_id" = "Product"."id"
LEFT JOIN "locations" AS "Location" ON "Stock"."location_id" = 
"Location"."id"

but i don't have the slightest idea as what I need to do in cake to get 
that changed.

the relevant models are :

class Location extends AppModel
{
var $name = 'Location';
var $hasMany = 'User,Stock,Sale,Salesstat';
}

Class Product extends AppModel
 {
 var $name = 'Product';
 var $hasMany = 'Stock';

 }

class Stock extends AppModel
{
var $name = 'Stock';
var $belongsTo = 'Product,Location';
   
}







--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Mysteries with findAll ???

2006-11-07 Thread Bernard Grosperrin

OK, I don't get it!!!

The SQL code generated looks OK, but I don't get the results...!

I am sure there is (are) better ways, I am still discovering cake (and 
PHP, BTW)!

Here is the request generated (got it through debug):

SELECT "Stock"."product_id" AS "Stock__product_id", 
"Stock"."location_id" AS "Stock__location_id", "Stock"."on_hand_units" 
AS "Stock__on_hand_units", "Stock"."committed_units" AS 
"Stock__committed_units", "Stock"."on_order_units" AS 
"Stock__on_order_units", "Stock"."on_hand_dollars" AS 
"Stock__on_hand_dollars", "Stock"."exch_cost" AS "Stock__exch_cost", 
"Stock"."last_exch_cost" AS "Stock__last_exch_cost", "Stock"."created" 
AS "Stock__created", "Stock"."modified" AS "Stock__modified", 
"Product"."id" AS "Product__id", "Product"."description" AS 
"Product__description", "Product"."size_description" AS 
"Product__size_description", "Product"."section_size" AS 
"Product__section_size", "Product"."aspect_size" AS 
"Product__aspect_size", "Product"."tire_rim_size" AS 
"Product__tire_rim_size", "Product"."plg_type" AS "Product__plg_type", 
"Product"."speed_rating" AS "Product__speed_rating", 
"Product"."load_rating" AS "Product__load_rating", "Product"."side_wall" 
AS "Product__side_wall", "Product"."created" AS "Product__created", 
"Product"."modified" AS "Product__modified", "Location"."id" AS 
"Location__id", "Location"."name" AS "Location__name", 
"Location"."opensunday" AS "Location__opensunday", "Location"."created" 
AS "Location__created", "Location"."modified" AS "Location__modified" 
FROM "stocks" AS "Stock" LEFT JOIN "products" AS "Product" ON 
"Stock"."product_id" = "Product"."id" LEFT JOIN "locations" AS 
"Location" ON "Stock"."location_id" = "Location"."id" WHERE 
"Product"."section_size" = 265 AND "Product"."aspect_size" = 70 LIMIT 100

the same (simplified) request in Postgresql:

SELECT * FROM stocks LEFT JOIN products ON stocks.product_id 
=products.id LEFT JOIN locations ON stocks.location_id = locations.id
WHERE products.section_size = 265 AND products.aspect_size = 70

give me 58 (expected) rows,  while, if I have one of the values, like 
section_size, where there is no match, I get no results with cake 
(expected), but I get ALL rows (422) if there is a match!

here is the code in my controller, which, I am sure, will make some 
laugh
Thanks for any help!

 class StocksController extends AppController

 {
 var $name = 'Stocks';
 var $components = array('Filter');   
 var $helpers = array('Html','Javascript','Time','Filter');
 var $uses = array('Stock', 'Product');

 function index($page = '1', $location = '0')
 { 
 $this->checkSession();
 uses('sanitize');
 $cleaner = new Sanitize();
 $page = $cleaner->paranoid($page);  
   
 if(!empty($this->data))  
   
 {
 $temparray = ($this->cleanArray($this -> 
data,'Product')) ;
 $myquery = 
$this->buildRequest($temparray['Product']);   
 if (count($temparray['Product']) <> 0)
 { 
  
print_r($myquery);   
$this->set('Stocks', 
$this->Stock->findAll($myquery,"","",100, $page));
$this->set('page',$page);

$this->set('total_stocks',$this->Stock->findCount($myquery));
 }
 else
 {
$this->set('Stocks', 
$this->Stock->findAll("","","",100, $page));
$this->set('page',$page);

$this->set('total_stocks',$this->Stock->findCount());  
  
 }
 /* clear the search */
 /*$this->data = array();*/

 }
 else
 {
 $this->set('Stocks', 
$this->Stock->findAll("","","",100, $page));
 $this->set('page',$page);
 
$this->set('total_stocks',$this->Stock->findCount()); 
   
 }

 }

 function cleanArray($array,$arrayToClean)
 {
 /* remove empty items in the array, so only fields 
with search vales are kept. */
   foreach ($array[$arrayToClean] as $index =>

Re: [professionel] Re: composite query

2006-11-02 Thread Bernard Grosperrin

Tim
> It sounds to me like you could use arrays, which may negate the need
> for all of these elseif's that you describe...  maybe combined with a
> foreach statement, building the query up inside there?
>   
Thanks you, that make sense, I will look at this.
> Your second point, I'm not sure I understand
>
> - the html form will be displayed as part of the view.
> - component - do you mean an element?  An element would be there to
> reuse code in more than one page, (or more than once on a page.).
>
> You could accept the data in a form, post back to the controller with
> the data, perform the query and rerender the same page, populating the
> previous empty table or whatever  with your newly selected data.
>   
OK, that's the idea, what confuses me is that I would need to have 2 
different functions in the controller, with the same view. I was under 
the assumption that each function needs to be associated with her own 
view. I am really still a beginner, so I would not be to surprised if I 
was assuming something wrong;-)
> If you wanted you could do this through ajax and just populate a div
> element or whatever without reposting back to the server but maybe you
> want to take one thing at a time.
>   
I thought of Ajax for this, but as you say, I am doing it a little step 
at a time...

Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Component problem.

2006-11-01 Thread Bernard Grosperrin

meek
>
> Yes you would - you don't need to call a function to 'create' an
> 'Undefined variable' - the previous poster was correct - the first
> thing you should do is make sure that the startup function is being
> called.
>
>   
I realized that after my post. Thanks for your help,
Bernard


--~--~-~--~~~---~--~~
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: [professionel] Re: Component problem.

2006-11-01 Thread Bernard Grosperrin

[EMAIL PROTECTED] wrote:
> Maybe startup is not the best method to set a controller variable in.
> Are you sure startup is even being called?
>   
I would not get an error if it was not called.

Bernard


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Component problem.

2006-10-31 Thread Bernard Grosperrin

Ok, I have made couple of components working well, but this one give me 
a error all the time, and I am unable to see what's wrong:


class StockRequestComponent extends Object
{
   var $controller = true;
   // I have to find a way to have a function here which can receive 
parameters(or not)
   // and would find only the locations for the current user
 
  function startup (&$controller)
   {
   $this->controller = &$controller;
   $Product = new Product;
   $data = $Product->findAll();
   
$this->controller->set('StockRequest',$data); 

   }  
}

The view is:




controller->name == 'Stocks')
{
echo '';
echo '';
echo 'http://cake.bgsoftfactory.com/stocks/index/1/0";>-- 
Select a Section --';
foreach ($StockRequest as $output):
echo 'http://cake.bgsoftfactory.com/stocks/index/1/' . 
$output['Product']['description'] . '">' . 
$output['Product']['description'];
endforeach;
echo '';
echo '';
} 
  ?>


the error is: " Undefined variable: StockRequest in.."etc

A very similar component, on a different table, works just fine. Thanks 
for your help,

Bernard


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



composite query

2006-10-31 Thread Bernard Grosperrin

I have 2 problems I need help with, but I will post 2 messages.

first: What would be the best way to have an interactive query?

I need to have users able to make a selection in 6 different columns, to 
build a query with WHERE this and that (6 this and that..), knowing they 
may select 1, or 2, or 3 or 4 or 5 or 6 values.

I would like to avoid making 36 ( 6* 6) elseif 

Also, visually, I would like to have  this on he same page displaying 
the data. Should it be a component, or can I have a form AND a view 
simultaneously?

I am not working often enough with Cake to be fully fluent, so any help 
will be greatly appreciated.

Bernard



--~--~-~--~~~---~--~~
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: [spam] Re: How to test for the current model?

2006-08-22 Thread Bernard Grosperrin

Mikee
>
> $this->controller
>
> so you can check for the controller name
>
> if ($this->controller->name == 'Blahs') {
>  display
> }
>
> or for the modelClass
>
> if ($this->controller->modelClass == 'Blah') {
>  display
> }
>   
Cool, thanks, it help!

Bernard


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to test for the current model?

2006-08-21 Thread Bernard Grosperrin

I need some help with something which looks like the cat chasing it's 
tail, to me, but I am a beginner!

I have a component which I call from the default.thtml view, as I want 
it in a sidebar, and that is defined there. But in fact, I would like 
that component displayed/active only when the user is on a specific set 
of controllers(2). Problem is, if I do not put var $components = 
array('mycomponent') in the app_controller, I get an error, because it's 
called from default.

So, how should I test, from the default view, which controller is 
currently in use?
Or is there another/better way?

Thanks,
Bernard


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



url need index.php?

2006-08-10 Thread Bernard Grosperrin

I have everything working pretty well, but

I have setup  my test directory as on a production server, not using 
.htacccess, but with the rewrite instructions in the httpd.conf:

   DocumentRoot "c:/ApacheSSL/htdocs/cake/app/webroot"
   ErrorLog logs/Cake-error.log
   CustomLog logs/Cake-access.log common
   
  Options None
  AllowOverride None
  Order allow,deny
  Allow from all

RewriteEngine On
RewriteCond c:/ApacheSSL/htdocs/cake/app/webroot%{REQUEST_FILENAME} !-d
RewriteCond c:/ApacheSSL/htdocs/cake/app/webroot%{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]

It works well, but if I just put the URL, it gives me an error 404, not 
found. If I put URL /index.php, it works fine

I have:

AddType application/x-httpd-php .php .asx
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.php

in my httpd.conf, after the LoadModules section, and other PHP sites are 
working well off the same Apache server.

What am I missing?

Thanks!

Bernard



--~--~-~--~~~---~--~~
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: [spam] Re: Custom SQL Requests?

2006-08-10 Thread Bernard Grosperrin

John David Anderson (_psychic_) wrote:
> You can always use query() and execute() for custom SQL, though I'd  
> probably stick to the model functions as often as I could.
>
> -- John
>   
Ok, excellent! Thanks very much for the fast answer, John!

Bernard


--~--~-~--~~~---~--~~
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 SQL Requests?

2006-08-10 Thread Bernard Grosperrin

Very new, trying to learn and understand.

What is the proper way to have my own SQL Statements? For example, if I 
want to add "ORDER BY", or "GROUP BY", etc..
Have been trying to search for "Custom SQL", but have not found what I 
was looking for.

Thanks for any hint,
Bernard


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



The Cake Blog Manual, section 8

2006-08-09 Thread Bernard Grosperrin

I have my list of Blog entries displayed nicely, after modifying 
routes.php as instructed.

But when adding the view action, I get this error:


  Bad Request

Your browser sent a request that this server could not understand.

I am pretty sure I have to modify routes.php to take into account the 
url /posts/view/x, but my attempts have all been wrong so far.

Thanks for any help, I would really like to go through the whole tutorial.

Bernard

--~--~-~--~~~---~--~~
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 to CakePHP and already a problem!

2006-08-09 Thread Bernard Grosperrin

nate ,
> You're new to Cake and you already have a problem?  Is that surprising
> because you'd have expected to encounter a problem after having used it
> for longer?  I'd guess that it's more the other way around: you haven't
> used it long, therefore you're inexperienced in addressing issues with
> it.  Causality and assumption are funny that way.  In any case...
>   
I did not have any negative intent in this post. I am sorry if the 
subject was/is perceived as a critic. English is my second language, and 
it may have a connotation I had no idea I was putting in here

> It looks like you're trying to over-complicate your setup, which is one
> thing I definitely wouldn't start with if you're new to Cake.  The
> first two things that jump out at me with your configuration are that
> you've set CAKE_CORE_INCLUDE_PATH to C:\Cake, when the actual path is
> C:\cake.  I know Windows is usually case insensitive, but maybe it
> makes a difference in PHP/Apache.
>   
Ho, I did not see that, thanks
> The other thing is your APP_DIR setting.  In all the customizations I
> have ever done to Cake, I've never had to change this setting, and I'm
> pretty sure it should not be set to 'webroot'.  Try changing this setting 
> back to the default, and see if that fixes your problem.
>   
OK, I will re-install, and go from there, thanks.

Bernard



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



New to CakePHP and already a problem!

2006-08-08 Thread Bernard Grosperrin

Hello, I am new and try to discover CakePHP.

It seems I have a problem with my paths. I am on windows XP with PHP 
5.1.4 and Apache 2.0 SSL

here is my directory structure on disk:

C:\
   ApacheSSL
  htdocs
 cake
app
  config
  ...etc
  webroot

 cake
  cake
  vendors

Here is my httpd.conf for my test directory:


   ServerAdmin [EMAIL PROTECTED]
   ServerName cake.bgsoftfactory.com
   #RewriteEngine On
   DocumentRoot "c:/ApacheSSL/htdocs/cake/app/webroot"
   ErrorLog logs/Cake-error.log
   CustomLog logs/Cake-access.log common
   
  Options None
  AllowOverride None
  Order allow,deny
  Allow from all

   RewriteEngine On
   RewriteCond c:/ApacheSSL/htdocs/cake/app/webroot%{REQUEST_FILENAME} !-d
   RewriteCond c:/ApacheSSL/htdocs/cake/app/webroot%{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]


here is what I get when attempting to see my installation:

*Warning*: require(config\core.php) [function.require 
]: failed to open 
stream: No such file or directory in *C:\cake\cake\bootstrap.php* on 
line *34*

*Fatal error*: require() [function.require 
]: Failed opening 
required 'config\core.php' 
(include_path='.;D:\PHP\PEAR\pear;D:\PHP\includes;C:\Cake;C:\ApacheSSL\Htdocs\cake\webroot\')
 
in *C:\cake\cake\bootstrap.php* on line *34

here is my index.php:
*
if (!defined('ROOT')) {
 define('ROOT', 'C:'.DS.'ApacheSSL'.DS.'Htdocs'.DS.'cake');
}
if (!defined('APP_DIR')) {
 //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION';
 define('APP_DIR','webroot');
}
/**
 * This only needs to be changed if the cake installed libs are located
 * outside of the distributed directory structure.
 */
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
 define('CAKE_CORE_INCLUDE_PATH', 'C:'.DS.'Cake');
}
*
What I don't understand is that i see, in index.php
*
 define('APP_PATH', ROOT . DS . APP_DIR . DS);
 define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);

Which in my case translate as APP_PATH= C:\ApacheSSL\htdocs\cake\webroot
Then, in bootstrap.php

I see require APP_PATH.'config'.DS.'core.php. which translate into 
C:\ApacheSSL\Htdocs\cake\webroot\config\core.php
And it obviously can't work, as config is under app, not webroot

If this was added to ROOT, it would work.

Anyway, I am lost, and would really like to get that to work!

Thanks,
Bernard
*

*

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---