Need your help
Sep. 17th, 2010 | 07:41 pm
posted by:
may_cat_ghost in
cakephp
Hi there.
My model uses multiply tables, not single one. Those tables have unique CHAR strings as primary key, so their contents don't intersect.
I need my model to search through all of these tables. But cake's FIND method doesn't allow to specify table to search in. And also doesn't allow to use mysql's UNITE constructions.
So, I should use such an monster construction like
________________________________________ __
$this->setSource($table1);
$r=$this->find(....);
if (! $r)
{
$this->setSource($table2);
$r=$this->find(....);
}
if (! $r)
{
$this->setSource($table3);
$r=$this->find(....);
}
& etc
________________________________________ __
It seems to me to be at least extreamly slow. All this job can be mady with only one MySQL query like:
________________________________________ __
SELECT <..> FROM `<table1>` WHERE <..> ORDER <..> <...>
UNITE
SELECT <..> FROM `<table2>` WHERE <..> ORDER <..> <...>
UNITE
SELECT <..> FROM `<table3>` WHERE <..> ORDER <..> <...>
& etc
________________________________________ __
Do you have idea, how to do it? It seems to me, that the only way is copypasting cake's "find" method and changing it my situation.
Maybee there is another way?
Update
Solution found.
My model uses multiply tables, not single one. Those tables have unique CHAR strings as primary key, so their contents don't intersect.
I need my model to search through all of these tables. But cake's FIND method doesn't allow to specify table to search in. And also doesn't allow to use mysql's UNITE constructions.
So, I should use such an monster construction like
________________________________________
$this->setSource($table1);
$r=$this->find(....);
if (! $r)
{
$this->setSource($table2);
$r=$this->find(....);
}
if (! $r)
{
$this->setSource($table3);
$r=$this->find(....);
}
& etc
________________________________________
It seems to me to be at least extreamly slow. All this job can be mady with only one MySQL query like:
________________________________________
SELECT <..> FROM `<table1>` WHERE <..> ORDER <..> <...>
UNITE
SELECT <..> FROM `<table2>` WHERE <..> ORDER <..> <...>
UNITE
SELECT <..> FROM `<table3>` WHERE <..> ORDER <..> <...>
& etc
________________________________________
Do you have idea, how to do it? It seems to me, that the only way is copypasting cake's "find" method and changing it my situation.
Maybee there is another way?
Update
Solution found.
Link | Leave a comment | Add to Memories | Share
Tags and Rights
Apr. 17th, 2007 | 01:52 pm
posted by:
texhapb in
cakephp
I'm planning to use tags at my site instead of tree of content. Also there's an opportunity to create a tree from tags (if there's more then 1 tag assigned to an element).
But how can I set up rights for an elements? Yes, I can set it for every element, but what's for a groups of elements, such as sections and subsections in ordinary tree content categorising system?
But how can I set up rights for an elements? Yes, I can set it for every element, but what's for a groups of elements, such as sections and subsections in ordinary tree content categorising system?
Link | Leave a comment {4} | Add to Memories | Share
Setting up an application
Apr. 3rd, 2007 | 12:00 pm
posted by:
texhapb in
cakephp
Does anyone have some thoughts on automatic installing of cakePHP applications?
For example, if the table is missing the check_and_install action is performed to check the table presence and structure and create or fix them.
For example, if the table is missing the check_and_install action is performed to check the table presence and structure and create or fix them.
Link | Leave a comment {4} | Add to Memories | Share
URL reversing.
Mar. 25th, 2007 | 08:53 pm
posted by:
texhapb in
cakephp
As you know, there's an URL parser in cake. But we have to write all URLs by hands in "flash" messages, "redirects", views etc.
Does anyone have any suggestions how to automatize this task? This means that it should be really simple way to change site routing.
Does anyone have any suggestions how to automatize this task? This means that it should be really simple way to change site routing.
Link | Leave a comment {6} | Add to Memories | Share
Cook up Web sites fast with CakePHP, Part 4: Session and Request Handler components
Jan. 9th, 2007 | 10:17 pm
posted by:
bobalien in
cakephp
http://www-128.ibm.com/developerworks/e du/os-dw-os-php-cake4.html
There are multiple ways of saving session data using CakePHP's Session component, and each method has its advantages. In this tutorial, you'll learn how to use the Session component by incorporating all three ways into your application, so you'll be able to pick the best one that works for you. You'll also learn how to use the Request Handler component to aid you in your handling of various HTTP requests, including requests from mobile browsers, or requests containing XML or HTML content.
This tutorial is divided into two main topics:
* The different types of session handling covered by CakePHP -- You will learn the advantages and disadvantages of each, and how to implement them.
* How to use the RequestHandler in your controllers -- We will use it for two purposes: to add an RSS feed of your products and to implement Ajax functionality.
There are multiple ways of saving session data using CakePHP's Session component, and each method has its advantages. In this tutorial, you'll learn how to use the Session component by incorporating all three ways into your application, so you'll be able to pick the best one that works for you. You'll also learn how to use the Request Handler component to aid you in your handling of various HTTP requests, including requests from mobile browsers, or requests containing XML or HTML content.
This tutorial is divided into two main topics:
* The different types of session handling covered by CakePHP -- You will learn the advantages and disadvantages of each, and how to implement them.
* How to use the RequestHandler in your controllers -- We will use it for two purposes: to add an RSS feed of your products and to implement Ajax functionality.
Link | Leave a comment | Add to Memories | Share
christmas presents from the cake team
Dec. 28th, 2006 | 03:23 pm
posted by:
bobalien in
cakephp
I'm a little late in catching it, but the dev team released 2 new versions of CakePHP on Christmas day:
Version 1.1.12.4205 is a bugfix release with no major changes
Also released is a development version of Cake 1.2, which I'm excited to start playing with. You can read more about it here in this Bakery article.
Happy holidays, and happy baking.
Version 1.1.12.4205 is a bugfix release with no major changes
Also released is a development version of Cake 1.2, which I'm excited to start playing with. You can read more about it here in this Bakery article.
Happy holidays, and happy baking.
Link | Leave a comment | Add to Memories | Share
(no subject)
Dec. 21st, 2006 | 06:42 pm
posted by:
sevka in
cakephp
I have model A and model B. Can I use model B inside the model A class?
Link | Leave a comment {4} | Add to Memories | Share
some more bugs in the developerWorks tutorial
Dec. 20th, 2006 | 05:26 pm
posted by:
bobalien in
cakephp
I hit another little bug in the developerWorks tutorial; there's a problem in Part 2, Section 8: Putting your ACLs to work
( continued... )
( continued... )
Link | Leave a comment | Add to Memories | Share
bug(s) with acl.php
Dec. 20th, 2006 | 02:21 pm
posted by:
bobalien in
cakephp
I've been running through the developerWorks articles on Cake, and hit a little bug during the ACL steps; I was getting 2 errors, one regarding array_shift() requiring an array parameter, and the other stating "class 'Configure' not found"
The first issue was my fault; I recently installed PHP5 and Apache2.2, and my php directory is now c:\php5, but c:\php was still in my Windows PATH list, so when I was running php from my command line, it was calling c:\php\php.exe (which was my old php4.x install) and for whatever reason the line "$serverArgs = env('argv');" in acl.php was returning nothing; I took out c:\php from my path, and the warning disappeared. Probably nothing anyone else will hit, but as a heads up, if you ever experience bizarre CLI behavior, and you have multiple PHP installs either specify the full pull for php.exe, or check on your PATH variable.
The second issue has already been addressed by the Cake team (https://trac.cakephp.org/changeset/407 8) but the code has not been merged into the trunk yet, so even if you have the latest nightly build, you get the error 'class Configure not found'; changing the uses() call on line 93 to include 'configure' fixes this issue.
EDIT: The acl fix above still does not allow "initdb" to be run for me; if you're having a problem with running initdb, you can just run the sql file app/config/sql/db_acl.sql on your database by hand. The ACL "create" command seems to be running just fine.
The first issue was my fault; I recently installed PHP5 and Apache2.2, and my php directory is now c:\php5, but c:\php was still in my Windows PATH list, so when I was running php from my command line, it was calling c:\php\php.exe (which was my old php4.x install) and for whatever reason the line "$serverArgs = env('argv');" in acl.php was returning nothing; I took out c:\php from my path, and the warning disappeared. Probably nothing anyone else will hit, but as a heads up, if you ever experience bizarre CLI behavior, and you have multiple PHP installs either specify the full pull for php.exe, or check on your PATH variable.
The second issue has already been addressed by the Cake team (https://trac.cakephp.org/changeset/407
EDIT: The acl fix above still does not allow "initdb" to be run for me; if you're having a problem with running initdb, you can just run the sql file app/config/sql/db_acl.sql on your database by hand. The ACL "create" command seems to be running just fine.
Link | Leave a comment | Add to Memories | Share
Cook up Websites Fast..., Part 3
Dec. 19th, 2006 | 01:13 pm
posted by:
bobalien in
cakephp
Part 3 of IBM's developerWorks series on Cake has been published:
Cook up Web sites fast with CakePHP, Part 3: Use Sanitize for your protection
CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP. Part 1 focuses on getting CakePHP up and running, and Part 2 demonstrates how to use scaffolding and Bake. In this article, you will learn how to use CakePHP's Sanitize and Security components to help secure your user-submitted data. You will also learn how to handle invalid requests.
http://www-128.ibm.com/developerworks/o pensource/library/os-php-cake3/
Links to part 1 and 2 can be found below, and in Part 3
Cook up Web sites fast with CakePHP, Part 3: Use Sanitize for your protection
CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP. Part 1 focuses on getting CakePHP up and running, and Part 2 demonstrates how to use scaffolding and Bake. In this article, you will learn how to use CakePHP's Sanitize and Security components to help secure your user-submitted data. You will also learn how to handle invalid requests.
http://www-128.ibm.com/developerworks/o
Links to part 1 and 2 can be found below, and in Part 3