Multiple database connections in CakePHP 2.1 can't works

2012-02-11 Thread yodi aditya
Hello all,

I've download fresh CakePHP 2.1 and try to make multiple database
connections. Here are my configuration :

Config/default.php :

?php
class DATABASE_CONFIG {
public $default = array(
'datasource' = 'Database/Mysql',
'persistent' = false,
'host' = 'localhost',
'login' = 'root',
'password' = '',
'database' = 'cake_one',
);

public $navigator = array(
'datasource' = 'Database/Mysql',
'persistent' = false,
'host' = 'localhost',
'port' = 3306,
'login' = 'root',
'password' = '',
'database' = 'cake_two',
);
}


Model/Navigator.php

?php
App::uses('AppModel', 'Model');
/**
 * Navigator Model
 *
 */
class Navigator extends AppModel {
/**
 * Primary key field
 *
 * @var string
 */
public $useDbConfig = 'navigator';
public $useTable = false;

}


Controller/NavigatorsController.php :
?php
App::uses('AppController', 'Controller');

/**
 * Navigators Controller
 *
 * @property Navigator $Navigator
 * @property SecurityComponent $Security
 */
class NavigatorsController extends AppController {

/**
 * Helpers
 *
 * @var array
 */
public $helpers = array('Html', 'Form');
public $uses = array('Driver');

/**
 * index method
 *
 * @return void
 */
public function index() {
$this-Drive-recursive = 0;
$this-set('Drive', $this-paginate());
}


And when accessing /navigators/index , I got :

Error: Table drivers for model Driver was not found in datasource
default.
Notice: If you want to customize this error message, create app/View/
Errors/missing_table.ctp

was not found in datasource default. it mean cakephp still look at
default not navigator.

Any wrong here ?

Thanks


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: asking about Vertical database on CakePHP

2008-09-24 Thread Yodi Aditya
@leberle : Nevermind. Just like me, confused about horizontal and verticall
in begining.

@mark :
Thanks Mark!, Extendable behaviour is good stuff.

Nice reference ..
On 9/23/08, mark_story [EMAIL PROTECTED] wrote:


 As for an already built solution to EAV in cake take a look at


 http://debuggable.com/posts/unlimited-model-fields-expandable-behavior:48428c2e-9a88-47ec-ae8e-77a64834cda3

 Seems to fit the bill pretty closely, and you retain a fair bit of
 'magic'


 -Mark



 On Sep 23, 3:50 am, leberle [EMAIL PROTECTED] wrote:
  No, actually i cantbecause i confused vertical with horizontal :D
  Sorry for that.
  Well, after the smoke cleared, i must say: Sounds interesting :)
 
  On Sep 22, 9:42 pm, Yodi Aditya [EMAIL PROTECTED] wrote:
 
   Can you give some reason why vertical database is bad and horrible?
   This is one of many ebook i have read before (in attachment)
   the title is Storage and querying of E-commerce data - IBM Almaden
   Research Center.
 
   Google Big Table using vertical database too..(reading from some
 article...)
   In my opinion, for big e-commerce, vertical database is right choices.
 
   But, i just wanna know if anybody using vertical database on CakePHP.
   thanks for sharing ...
 
   On 9/22/08, leberle [EMAIL PROTECTED] wrote:
 
Sounds like a horrible ideaand bad DB design.
If you have your DB in Boyce-Codd normal form, you will never have
 the
need for such a DB layout...
 
But let me know about your experience :)
 
On Sep 21, 7:23 pm, Yodi Aditya [EMAIL PROTECTED] wrote:
 I have reading about vertical database (column-store) on google
 last
night.
 it seem interesting method.
 
 Is anybody using vertical database with CakePHP?
 Is vertical database good for designing some application using
 cakePHP?
 
 if someone has vertical database using cakePHP, please let me
 know..
 
 Thanks
 
P149.pdf
   211KViewDownload
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: asking about Vertical database on CakePHP

2008-09-23 Thread Yodi Aditya
Many thanks, Joel.
now i'm understand what cake's design for ...

Great reference with magento.
i have tried it before..

On Tue, Sep 23, 2008 at 4:09 AM, Joel Perras [EMAIL PROTECTED] wrote:


 I believe what you are referring to is the entity-attribute-value data
 model (sometimes referred to as the object-attribute-value model):
 http://en.wikipedia.org/wiki/Entity-Attribute-Value_model
 This database model is actually used in Magento, an open-source
 eCommerce PHP framework.

 This is a highly specialized DB model that aims to solve problems
 caused by data-sparseness that is common to eCommerce, whereby you
 have many products (entities), each with different subsets of
 attributes and corresponding values.

 Cake was never designed to solve this problem, and is thus not well
 suited for this type of implementation; however, Cake does not enforce
 a specific DB design principle on you.  You will lose many of the
 features that make Cake an attractive choice for development (ie. Auth
 component, ACL, etc.), but implementing an EAV DB design is
 nonetheless possible.

 Just don't ask me to do it.

 -J.

 On Sep 22, 3:42 pm, Yodi Aditya [EMAIL PROTECTED] wrote:
  Can you give some reason why vertical database is bad and horrible?
  This is one of many ebook i have read before (in attachment)
  the title is Storage and querying of E-commerce data - IBM Almaden
  Research Center.
 
  Google Big Table using vertical database too..(reading from some
 article...)
  In my opinion, for big e-commerce, vertical database is right choices.
 
  But, i just wanna know if anybody using vertical database on CakePHP.
  thanks for sharing ...
 
  On 9/22/08, leberle [EMAIL PROTECTED] wrote:
 
 
 
   Sounds like a horrible ideaand bad DB design.
   If you have your DB in Boyce-Codd normal form, you will never have the
   need for such a DB layout...
 
   But let me know about your experience :)
 
   On Sep 21, 7:23 pm, Yodi Aditya [EMAIL PROTECTED] wrote:
I have reading about vertical database (column-store) on google last
   night.
it seem interesting method.
 
Is anybody using vertical database with CakePHP?
Is vertical database good for designing some application using
 cakePHP?
 
if someone has vertical database using cakePHP, please let me know..
 
Thanks
 
 
 
   P149.pdf
  211KViewDownload
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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 reading cookie

2008-09-22 Thread Yodi Aditya
Good, i hope this will be help many people :D

On 9/23/08, Kenchu [EMAIL PROTECTED] wrote:


 Nice. :)
 I also commented those pages in the docs...


 On Sep 21, 6:45 pm, villas [EMAIL PROTECTED] wrote:
  Yes,  you are right about that introduction; that section seems to be
  out of date when compared to the API:
 
  http://api.cakephp.org/cookie_8php-source.html
 
  I have now submitted an update for that section of the Book so that
  others will not be so confused. Hopefully it will appear soon once it
  has been reviewed.
 
  On Sep 20, 8:50 pm, Kenchu [EMAIL PROTECTED] wrote:
 
   Actually, none of the properties seem to work, atleast not for me.
   Name and key (apart from time) do not work. Setting them directly in
   beforeFilter works though.
 
   On Sep 20, 9:41 pm, Kenchu [EMAIL PROTECTED] wrote:
 
I dont see the point of having a page where they show how to set
properties in the controller if they dont work. As you said, I did
 not
use the long version of the write command, since it said on the page
before how to set it up using properties.
 
On Sep 20, 6:30 pm, villas [EMAIL PROTECTED] wrote:
 
 Before you criticise,  are you sure that you read and tried what it
 said in the docs?
 
 Example given in the docs is:
 $this-Cookie-write('last_name', 'Masters', false, '1 hour');
 
 Therefore you should be able to do this:
 $this-Cookie-write('cart', array(124,1232,3232), false, '1
 hour');
 
 From your question,  it does not seem that you tried that code.
 However,  if you really did find a 'better way',  please make a
 comment in the docs to help the next guy.
 
 Best wishes.
 
 On Sep 20, 2:05 pm, Kenchu [EMAIL PROTECTED] wrote:
 
  Thanks! Works perfect now. Though I think it's bad they dont say
 this
  in the documentation.
 
  On Sep 20, 11:42 am, Yodi Aditya [EMAIL PROTECTED] wrote:
 
   Try using :
   function beforeFilter() {
   $this-Cookie-time = '5 Days';
   $this-Cookie-path = '/';
 
   }
 
   On 9/20/08, Kenchu [EMAIL PROTECTED] wrote:
 
I've managed to get cookies working for the session, but if I
 restart
my browser, the cookies seem to be gone, and $cookieTime
 doesn't seem
to do anything about it. This is the code I've got:
 
___
 
[...]
 
var $cookieName = 'my.cookie';
var $cookieTime = 3600;
var $cookieKey = '***';
 
function index() {
//  $this-Cookie-write('cart',
 array(124,1232,3232));
pr($this-Cookie-read('cart'));
}
 
[...]
 
___
 
So what I do is uncomment the cookie-write-line, run the
 script, then
comment the line again, and then run the script once more.
 Now if you
DONT turn off the browser, you will see the array being
 printed.
However, if I restart the page and visit it again, nothing
 will be
printed.
 
Help plz. :D
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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
-~--~~~~--~~--~--~---



asking about Vertical database on CakePHP

2008-09-21 Thread Yodi Aditya
I have reading about vertical database (column-store) on google last night.
it seem interesting method.

Is anybody using vertical database with CakePHP?
Is vertical database good for designing some application using cakePHP?

if someone has vertical database using cakePHP, please let me know..

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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 reading cookie

2008-09-20 Thread Yodi Aditya
Try using :
function beforeFilter() {
$this-Cookie-time = '5 Days';
$this-Cookie-path = '/';
}

On 9/20/08, Kenchu [EMAIL PROTECTED] wrote:


 I've managed to get cookies working for the session, but if I restart
 my browser, the cookies seem to be gone, and $cookieTime doesn't seem
 to do anything about it. This is the code I've got:

 ___

 [...]

 var $cookieName = 'my.cookie';
 var $cookieTime = 3600;
 var $cookieKey = '***';

 function index() {
 //  $this-Cookie-write('cart', array(124,1232,3232));
 pr($this-Cookie-read('cart'));
 }

 [...]

 ___

 So what I do is uncomment the cookie-write-line, run the script, then
 comment the line again, and then run the script once more. Now if you
 DONT turn off the browser, you will see the array being printed.
 However, if I restart the page and visit it again, nothing will be
 printed.

 Help plz. :D
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: Change Auth component will solve hash without salt?

2008-09-11 Thread Yodi Aditya
Hey, dude.
Thanks, that's right sha1 is default hashing in auth component.
i just convience that using correct hashing sha1 in my controller using
beforeFilter().

But,
I say before, security.salt needed not only for Auth but hashing cookies
too.
Disable security.salt is a bad solution.

I'm login using Auth component, just like this :

function login() {
if ($this-Auth-user()) {
if (!empty($this-data)) {
$this-redirect($this-Auth-redirect());
}
  }
}

user() check username and password automatically.
When checking password, Auth always hashing using sha1 combine with
security.salt.
It's makes different value compare with my password in database that's using
sha1 only.

Anyone help?



On 9/10/08, Okto Silaban [EMAIL PROTECTED] wrote:

 Why do you need to set Security::setHash('sha1') in beforeFilter() function
 ?

 CakePHP use sha1 as default encryption.

 Meanwhile, you can use this In login form :

 $this-Auth-password($this-data['User']['password']) -- automatically
 using sha1 with salt.


 But if you want CakePHP use no .salt. at all, edit : app/config/core.php

 Just comment the following line :

 //Configure::write('Security.salt',
 '78bc27f1b49f17f5c3392e728f789bad78dbeb77');

 Okto.Silaban.Net

 On Wed, Sep 10, 2008 at 12:31 AM, Yodi Aditya [EMAIL PROTECTED] wrote:

 I have some users table with 2 value , email and password (hash with
 sha1).
 Then i using auth component to make login form.
 To make sure, that auth will using sha1 when hashing password, i'm using :
 Security::setHash('sha1'); in beforeFilter().

 Problem happen when Auth hashing password from password input form.
 Auth hashing password from input form with sha1 + security.salt. (not pure
 sha1).
 It's make different value between password input form and value in
 password table's with same words,
 example, clean password is test.
 hashing output test from Auth is different with sha1 hashing in password
 table.

 Make clean value on security.salt will be one bad solution.
 Cause cakePHP using security.salt not only on Auth, but encrypt cookies
 too.

 Then, i try edit cake/libs/controller/components/auth.php.
 .
 /**
  * Hash a password with the application's salt value (as defined with
 Configure::write('Security.salt');
  *
  * @param string $password Password to hash
  * @return string Hashed password
  * @access public
  */
 function password($password) {
 return Security::hash($password, null, true); --- i change this
 with false
 }
 /**
 .

 Problem solved. But still doubt about it.
 There are another way to make Auth hashing without security.salt ?




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: Change Auth component will solve hash without salt?

2008-09-11 Thread Yodi Aditya
Thanks David,

I want password in table hashing with sha1 only and without security.salt.
in another way, it will make me easy using same table with different
framework or CMS.
cause sha1 is include on most CMS / framework. Salt? i don't think so.

Cookies needed for  remember me  on login form.
I need security.salt to hash them and I don't put user password on cookies.

I think someone has same problem with me.
Just in some case, you want to build some cakephp based site.
but, received some user and password data (hashed with sha1) before.

how to use this with Auth component...

On 9/11/08, David C. Zentgraf [EMAIL PROTECTED] wrote:

 Not quite sure I understand your particular issue, but why is the
 password in your DB pure SHA1?
 If you're using the Auth component all the way, it will hash the
 password including Salt when the user registers, so the only thing
 that should go into the db is SHA1(salt.password). And every time the
 user logs in, Auth uses the same SHA1(salt.password) for checking.

 If of course you got the passwords into the DB in another way, using
 only SHA1(password), you'll get conflicting results...

 And what do you want to do with cookies?

 Chrs,
 Dav


 On 11 Sep 2008, at 15:36, Yodi Aditya wrote:

  Hey, dude.
  Thanks, that's right sha1 is default hashing in auth component.
  i just convience that using correct hashing sha1 in my controller
  using
  beforeFilter().
 
  But,
  I say before, security.salt needed not only for Auth but hashing
  cookies
  too.
  Disable security.salt is a bad solution.
 
  I'm login using Auth component, just like this :
 
  function login() {
  if ($this-Auth-user()) {
 if (!empty($this-data)) {
 $this-redirect($this-Auth-redirect());
 }
   }
  }
 
  user() check username and password automatically.
  When checking password, Auth always hashing using sha1 combine with
  security.salt.
  It's makes different value compare with my password in database
  that's using
  sha1 only.
 
  Anyone help?
 
 
 
  On 9/10/08, Okto Silaban [EMAIL PROTECTED] wrote:
 
  Why do you need to set Security::setHash('sha1') in beforeFilter()
  function
  ?
 
  CakePHP use sha1 as default encryption.
 
  Meanwhile, you can use this In login form :
 
  $this-Auth-password($this-data['User']['password']) --
  automatically
  using sha1 with salt.
 
 
  But if you want CakePHP use no .salt. at all, edit : app/config/
  core.php
 
  Just comment the following line :
 
  //Configure::write('Security.salt',
  '78bc27f1b49f17f5c3392e728f789bad78dbeb77');
 
  Okto.Silaban.Net
 
  On Wed, Sep 10, 2008 at 12:31 AM, Yodi Aditya [EMAIL PROTECTED]
  wrote:
 
  I have some users table with 2 value , email and password (hash with
  sha1).
  Then i using auth component to make login form.
  To make sure, that auth will using sha1 when hashing password, i'm
  using :
  Security::setHash('sha1'); in beforeFilter().
 
  Problem happen when Auth hashing password from password input form.
  Auth hashing password from input form with sha1 + security.salt.
  (not pure
  sha1).
  It's make different value between password input form and value in
  password table's with same words,
  example, clean password is test.
  hashing output test from Auth is different with sha1 hashing in
  password
  table.
 
  Make clean value on security.salt will be one bad solution.
  Cause cakePHP using security.salt not only on Auth, but encrypt
  cookies
  too.
 
  Then, i try edit cake/libs/controller/components/auth.php.
  .
  /**
  * Hash a password with the application's salt value (as defined with
  Configure::write('Security.salt');
  *
  * @param string $password Password to hash
  * @return string Hashed password
  * @access public
  */
 function password($password) {
 return Security::hash($password, null, true); --- i change
  this
  with false
 }
  /**
  .
 
  Problem solved. But still doubt about it.
  There are another way to make Auth hashing without security.salt ?
 
 
 
 
 
 
 
  


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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
-~--~~~~--~~--~--~---



Change Auth component will solve hash without salt?

2008-09-09 Thread Yodi Aditya
I have some users table with 2 value , email and password (hash with sha1).
Then i using auth component to make login form.
To make sure, that auth will using sha1 when hashing password, i'm using :
Security::setHash('sha1'); in beforeFilter().

Problem happen when Auth hashing password from password input form.
Auth hashing password from input form with sha1 + security.salt. (not pure
sha1).
It's make different value between password input form and value in password
table's with same words,
example, clean password is test.
hashing output test from Auth is different with sha1 hashing in password
table.

Make clean value on security.salt will be one bad solution.
Cause cakePHP using security.salt not only on Auth, but encrypt cookies too.

Then, i try edit cake/libs/controller/components/auth.php.
.
/**
 * Hash a password with the application's salt value (as defined with
Configure::write('Security.salt');
 *
 * @param string $password Password to hash
 * @return string Hashed password
 * @access public
 */
function password($password) {
return Security::hash($password, null, true); --- i change this
with false
}
/**
.

Problem solved. But still doubt about it.
There are another way to make Auth hashing without security.salt ?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: Auth Redirect Problems

2008-09-09 Thread Yodi Aditya
Try using :
$this-Auth-loginRedirect = array('controller'='users',
'action'='profile');
on beforeFilter()

then

function login() {
$this-redirect($this-Auth-redirect());
}

Yodiaditya - http://re.web.id

On 9/9/08, Tony Thomas [EMAIL PROTECTED] wrote:


 If someone is familiar with a post to this group or blog entry that
 addresses this issue, please let me know. I've spent the morning
 scouring both with no satisfactory results.

 I have a cakePHP app on a shared server. In local testing, everything
 worked fine. But mod_rewrite did not function properly on the shared
 server, so I'm using CakePHP pretty URLS instead. Also caching (at
 least temporarily) is off. I've uncommented the pertinent lines of
 code in core.php and I've dutifully deleted the .htaccess files.

 The problem I have is that after logging in, the redirect is
 inconsistent. About 2/3 of the time I get redirected to
 https://[base_url]/https:/[domain]. I just can't seem to find away
 around this problem.

 My login function looks like this:

 function login() {
 $this-Auth-loginRedirect = array('controller' =
 'controller_name', 'action' = 'index');
 }

 I still get inconsistent results with the redirect going to a URL like
 the former example the majority of the time. Any insight, links, etc.
 would be appreciated.

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: Vote for CakePHP built-in support for Netbeans 6.5!

2008-09-09 Thread Yodi Aditya
I'm try using netbeans 6.5 beta before. But, know back again to eclipse.
if netbeans 6.5 have good feature like eclipse, maybe i'll try again :D

On 9/7/08, Okto Silaban [EMAIL PROTECTED] wrote:

 I've been using Netbeans PHP from the first time playing with CakePHP..
 Of course i'll vote..

 Okto.Silaban.Net

 On Sun, Sep 7, 2008 at 1:36 AM, ĸεиلı [EMAIL PROTECTED] wrote:


 Netbeans 6.5 is coming soon. The main focus of version 6.5 is PHP
 development. Many works has been done to support PHP development out-
 of-box better.

 Now the Netbeans team is considering to support PHP frameworks for the
 coming Netbeans 6.5.

 http://blogs.sun.com/netbeansphp/

 Regardless you prefer Eclipse or any other editor/IDE to Netbeans,
 let's put that aside and vote for CakePHP to have it be supported in
 Netbeans 6.5, so that we can let more people know this nice framework!
 Afterall, it will only bring good to everyone of us to get another, if
 not the first, IDE to support CakePHP officially.

 http://www.netbeans.org/issues/show_bug.cgi?id=140918

 =)




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: Default Date Format

2008-09-09 Thread Yodi Aditya
use date function. in controller.
for example, date('Y-m-d H:i:s')

On 9/8/08, shabba [EMAIL PROTECTED] wrote:


 How do you set the default formatting for date. Its set to m-d-y as
 default, this is great, but when you need user interaction and the
 standard is d-m-Y. Its really not practical to add formatting to each
 $form-input, is there a better way?
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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: Containable Behavior Retrieve Data, help anybody please

2008-08-21 Thread Yodi Aditya
Thanks axel for your answer.
Result is :

Array
(
[0] = Array
(
[Item] = Array
(
[name] = Beruang Kuning
[item_id] = 3
)

[Vendor] = Array
(
[name] = Malang Boneka
[vendor_id] = 5
)

[Tag] = Array
(
[0] = Array
(
[name] = Toy
)

)

)

Same with my first :
$joinRecords=$this-Item-find('all',array('fields' =
array('Item.name'),'contain' = array('Tag.name','Vendor.name')));
debug($joinRecords);

maybe i still use bind and unbind behavior :D
Thanks

On 8/18/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


 $joinRecords=$this-Item-find('all',array('contain' =

 array('Tag.name','Vendor.name'),
   'fields'=array('name')));


 Yodi Aditya wrote:
  Hello,
  I have some problem with containable Behavior. I have 3 model Item,
  Tag and Vendor.
  This is the models :
 
  class Item extends AppModel {
  var $name = 'item';
  var $belongsTo = array('Vendor' =array(
  'className' = 'Vendor'));
  var $hasAndBelongsToMany = array('Tag' = array(
  'className' = 'Tag',
  'joinTable' = 'items_tags',
  'associationForeignKey' = 'tag_id'));
  }
 
  class Tag extends AppModel {
  var $name = 'Tag';
  var $hasAndBelongsToMany = array(
  'Item' = array(
  'className' = 'Item',
  'joinTable' = 'items_tags',
  'associationForeignKey' = 'item_id',
  ),
  );
  }
 
  class Vendor extends AppModel {
  var $name = 'Vendor';
  var $hasMany = 'Item';
  }
 
  Tags_controller and Vendor_controller using scaffolding. I set
  Item_controller like this :
 
  class ItemsController extends AppController {
  var $name = 'Items';
 
  function index() {
  $this-Item-field('name');
  $this-Item-Behaviors-attach('Containable');
  $joinRecords=$this-Item-find('all',array('fields' =
  array('Item.name'),'contain' = array('Tag.name','Vendor.name')));
  debug($joinRecords);
  }
  }
 
  In my Firefox, the result is :
  Array
  (
  [0] = Array
  (
  [Item] = Array
  (
  [name] = Beruang
  [id] = 3
 
  )
 
  [Vendor] = Array
  (
  [name] = GooMan
  [id] = 1
  )
 
  [Tag] = Array
  (
 
  [0] = Array
  (
  [name] = toy
  )
 
  )
 
  )
 
  Then i change
  $joinRecords=$this-Item-find('all',array('fields' =
  array('Item.name'),'contain' = array('Tag.name','Vendor.name')));
  with
  $joinRecords=$this-Item-find('all',array('contain' =
  array('Tag.name','Vendor.name')));
 
  Result is :
  Array
  (
  [0] = Array
  (
  [Item] = Array
  (
  [id] = 3
  [name] = Beruang
 
  [width] = 40
  [height] = 30
  [created] = 2008-06-07 21:28:12
  [modified] = 2008-08-04 14:55:08
  [status] = 1
 
  [slug] = beruang
  [vendor_id] = 1
  )
 
  [Vendor] = Array
  (
  [name] = GooMan
  )
 
 
  [Tag] = Array
  (
  [0] = Array
  (
  [name] = boneka
  )
 
  )
 
 
  )
 
  I want result is just name like this :
  Array
  (
  [0] = Array
  (
  [Item] = Array
  (
[name] = Beruang
 
  )
 
  [Vendor] = Array
  (
  [name] = GooMan
  )
 
  [Tag] = Array
  (
  [0] = Array
 
  (
  [name] = boneka
  )
 
  )
 
  )
 
  Can anybody help me, what should i do?
 
  



 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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
-~--~~~~--~~--~--~---



Difference cake bake controller User scaffold or without scaffold, need explanation

2008-05-22 Thread yodi aditya
I'm newbie. I'm using cake bake console . Then the problem is when using
command *cake bake controller Types*
then the output :
?php
class TypesController extends AppController {

var $name = 'Types';
var $scaffold;
}
?

but if using  command *cake bake controller Types scaffold* then the
output generate add(), edit() , etc

?php
class TypesController extends AppController {

var $name = 'Types';
var $helpers = array('Html', 'Form');

function index() {
$this-Type-recursive = 0;
$this-set('types', $this-paginate());
}

.

I'm using CakePHP 1.2 Night 21 may 2008. Anybody can say what happen? I'm
get chat in #cakePHP,
then somebody say it backward. I'm confuse with it. Which one good for
using?

thanks
-- 
yodiaditya
http://yodi.web.id
http://re.web.id

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP 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
-~--~~~~--~~--~--~---