Cakephp 3 and custom datasources

2015-05-31 Thread Martin
Hi,

For my current project I need to load data from different locations via 
API's. I think the best way to do this is to create datasources for it. 
Sadly I see there is nothing about datasources in the cakephp 3 book (only 
the text that is can be extended with alternative datasources). 
I also see there is no folder for datasources  in the 'src' folder of the 
app. So where should I put my datasource? 

I've find an older topic where is mark_story said Instead custom 
datasources that don't use sql should provide an implementation of the 
RepositoryInterface, a query builder and possible a specialized entity 
object.  (https://groups.google.com/forum/#!topic/cake-php/UDDArIYV0nM)

I'm using https://github.com/cakephp/elastic-search as example. but it 
should be nice if there was a simple example for a custom datasource. and 
maybe some default features for making a custom datasource easier. I think 
this is a big missing feature in cakephp 3 at the moment.

So My question is: Are there plans for better support (and documentation) 
for custom datasources? And is there a easy example how to create one? and 
How are other developers doing this at the moment? I think it is strange to 
make a component for receiving data.

Greetings,
Martin


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP 2.5 and ACL Groups Permissions not working

2014-07-31 Thread Martin Halla
HI , i have had problems with Cake's ACL.

I followed all the tutorials, had AROS, ACOS and AROS_ACOS table generated. 
I installed the Alexo's ACL plugin and made it work under version 2.5.2 
(finally).

I do have problem with the group permissions. Even though I set only one 
group to be able to  access specific action, it still allows another group 
to view the action too.

Basically, the ACL does not work for me at all. What am I missing?

Bellow is the code from AppController:

public $components = array(
'Acl',
'Auth' = array(
'loginAction' = array(
'controller' = 'users',
'action' = 'login',
'admin' = false
),
'loginRedirect' = array(
'controller' = 'users',
'action' = 'profile',
'admin' = false
),
'logoutRedirect' = array(
'controller' = 'users',
'action' = 'login',
'admin' = false
),
'authError' = 'Please login to continue',
'authenticate' = array(
'Form' = array(
'fields' = array(
'username' = 'username',
'password' = 'pwd'
),
'passwordHasher' = array(
'className' = 'Simple',
'hashType' = 'sha256'
)
)
),
   'authorize' = array(
'Actions' = array(
'actionPath' = 'controllers'
 )
),
/*
'authorize' = array(
'Actions',
'Controller'
),
*/
),
'Session'
);




public function beforeFilter()

{

// this is from bootstrap to allow development

if (APP_ACL_ENABLED == 0) {

// allow everything

$this-Auth-allow();

} else {

// nothing allowed

$this-Auth-allow(array());

};

} here...

I have been trying to set this for several days, with no success Any 
help is truly appreciated!!

Thank you, Martin

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Initiating a 'DELETE' or 'POST' in a folder inside webroot

2013-12-22 Thread Charles Martin Mendez
Hi,

I am using the fileupload jquery library. I was able to get everything 
working and migrated some functions to the controllers to make it 
compatible.

The problem I am encountering is that fileupload is creating a 'Delete' 
button which goes to the link below:
http://localhost/homsite/app/webroot/?file=*SAMPLE%PICTURE.JPG*

The button's property is data-type=DELETE

Basically what this should do is initiate a DELETE in the 'file' folder to 
remove SAMPLE PICTURE.JPG

I have tried this with a plain PHP setup and it is working fine.

Looking at the error returned, cakephp is routing the link to the 
controller:
Missing Method in AppController

Error: The action webroot is not defined in controller AppController

Error: Create AppController::webroot() in file: 
app\Controller\AppController.php.

?php
class AppController extends AppController {

public function webroot() {

}
}



Is it possible to make cakephp exempt the MVC for that particular link?

Thank you!






-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


POST and PUT problems on add action

2013-04-26 Thread Martin Aguilar
I'm new to cakephp and I'm start loving it but today I had a problem on 
adding new data (action add).
After baking users table the result was

public function add() { if ( $this-request-is('post') ) {



I had add some validation on my model to names and more fields. The first 
push on submit button show invalid validation messages but on second click 
on submit did nothing.
I found that the  $this-request-is('post') becomes false after first 
submit. I look on edit action and I see that also ask for put.

to solve this problem all I had to do was 

public function add() { if ( $this-request-is('post') || 
$this-request-is('put') ) {


It's working fine now for me and to to solve it on every baking I 
personalized my baking template on my project
app/Console/Templates/myTemplate/actions/controller_actions.ctp

I really don't know if this is the correct way to solve it, I've never used 
PUT on PHP apps that I made and I don't see a big difference either way.
I comment this because I don't know if is a bug on cake (tested on version: 
2.3.1 - 2.3.3 ). 

I hope this information helps and also I hope to see some comments to 
understand a little bit more.

tags: flash session message validation post put

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Update from Cakephp 2.3.0 to 2.3.1

2013-03-27 Thread Martin Aguilar
Yes, replacing the lib folder should be enough. 
what I do, is to organize the cake version I use on one folder. Then I make 
a junction from my app directory to the lib folder.
Junction it's like a symlink on *nix. So upgrade or downgrade from a 
different version of cake, only takes a second. On the other hand, it 
allows me to have only one single copy of cake for my different apps.



El jueves, 14 de marzo de 2013 19:56:39 UTC-3, cricket escribió:

 On Wed, Mar 13, 2013 at 11:51 AM, kaiszy 
 kaik...@googlemail.comjavascript: 
 wrote: 
  Hi again ;) 
  
  Sorry for my fuzzy mail ;) 
  
  For example i modify 
  
 cakeroot/app/Controller/AppController.php 
 cakeroot/app/View/Layouts/defaults.ctp 
 a.s.o. 
  
  These files are (ofcourse ;) also in then distribution archiv. 

 Do you mean your project's root, or the lib folder? It can be 
 confusing because there's a: 

 lib/Cake/Controller/AppController.php 

 and: 

 app/Controller/AppController.php 

 Both app and lib should be at the same level. 

 The files in app are the ones you should modify. Don't make changes to 
 anything in lib. 

  So i ask myself: What is the best practice to update Cakephp 
 Installations 
  (maybe compare app-File-by-file), 

 If the lib folder is untouched you're good to go. Download the version 
 you want and replace the lib folder. (Re-name the old one so you can 
 easily switch back.) You can also do this with git but if you're not 
 sure it's best to do it manually. 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to implement Smarty 3?

2013-02-12 Thread Martin Aguilar
Lorenzo, I do not fully understand your answer. and I'm sure it's because 
my limited knowledge about cake.

I'm not already familiarized with cake structure.
Can you gave me a hint where do I have to load smarty ( I mean in wich file 
I must include smarty, and where to instantiate it). 
What it this simple vendor layer?

Thanks a lot



El jueves, 29 de noviembre de 2012 08:18:43 UTC-3, lorenzoshake escribió:



 Il giorno sabato 17 novembre 2012 15:21:56 UTC+1, Martin Aguilar ha 
 scritto:

 For years I've been working on my own framework but now I wan't to 
 migrate to cakephp. 
 On my framework I used smarty for themes and to separate code from views. 
 I always find smarty clean, nice and with a very good performance.
 Now I want to use it on cake but I found people saying that it has no 
 purpose.
 And couldn't find a good article about implementing it. The only thing 
 that I found it's for cake 1.3 and smarty 2 and the article it's damage.

 http://bakery.cakephp.org/articles/tclineks/2006/10/27/how-to-use-smarty-with-cake-smartyviewOn
  point 4, I see a lot of unreadable symbols.

 Any help on implementing smarty 3 on cake 2?
 What it's your opinion onimplementing smarty or any other template system?

 Hi martin, when i use smarty inside cake i use a simple vendor layer that 
 wrap smarty where i can set/manage variables
 Set autorender to false and use smarty as usual 


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cake 2.2 Auth login failure

2013-01-06 Thread Martin Halla
I actually got that working by moving the code from the subdomain name to 
top level domain name.

Now I have a similar problem (another project) - I am using top level 
domain name on godaddy.com.

The code fails the authentication.

This is the AppController :


App::uses('Controller', 'Controller');

/**
 * Application Controller
 *
 * Add your application-wide methods in the class below, your controllers
 * will inherit them.
 *
 * @package   app.Controller
 * @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
 */
class AppController extends Controller {
public $components = array(
'Acl',
'Auth' = array(
'authorize' = array(
'Actions' = array('actionPath' = 'controllers')
)
),
'Session'
);
public $helpers = array('Html', 'Form', 'Session');

public function beforeFilter() {
//Configure AuthComponent
$this-Auth-loginAction = '/users/login';//array('controller' = 
'users', 'action' = 'login');
$this-Auth-logoutRedirect = array('controller' = 'users', 
'action' = 'login');
$this-Auth-loginRedirect = array('/admin/testimonials');
}


}


and this is the user controller that does the logging :

?php
App::uses('AppController', 'Controller');
/**
 * Users Controller
 *
 * @property User $User
 */
class UsersController extends AppController {
  public $uses = array('User');
  

public $layout = admin;

 public function beforeFilter() {
parent::beforeFilter();
//$this-Auth-allow(*);
}
 public function login() {
   $this-layout = default;
if ($this-request-is('post')) {
if ($this-Auth-login()) {
$this-redirect($this-Auth-redirect());
} else {
$this-Session-setFlash(__('Invalid username or password, try 
again'));
}
}
}
 public function logout() {
$this-redirect($this-Auth-logout());
}



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

/**
 * admin_view method
 *
 * @throws NotFoundException
 * @param string $id
 * @return void
 */
public function admin_view($id = null) {
$this-User-id = $id;
if (!$this-User-exists()) {
throw new NotFoundException(__('Invalid user'));
}
$this-set('user', $this-User-read(null, $id));
}

/**
 * admin_add method
 *
 * @return void
 */
public function admin_add() {
if ($this-request-is('post')) {
$this-User-create();
if ($this-User-save($this-request-data)) {
$this-Session-setFlash(__('The user has been saved'));
$this-redirect(array('action' = 'index'));
} else {
$this-Session-setFlash(__('The user could not be saved. Please, try 
again.'));
}
}
$groups = $this-User-Group-find('list');
$this-set(compact('groups'));
}

/**
 * admin_edit method
 *
 * @throws NotFoundException
 * @param string $id
 * @return void
 */
public function admin_edit($id = null) {
$this-User-id = $id;
if (!$this-User-exists()) {
throw new NotFoundException(__('Invalid user'));
}
if ($this-request-is('post') || $this-request-is('put')) {
if ($this-User-save($this-request-data)) {
$this-Session-setFlash(__('The user has been saved'));
$this-redirect(array('action' = 'index'));
} else {
$this-Session-setFlash(__('The user could not be saved. Please, try 
again.'));
}
} else {
$this-request-data = $this-User-read(null, $id);
}
$groups = $this-User-Group-find('list');
$this-set(compact('groups'));
}

/**
 * admin_delete method
 *
 * @throws MethodNotAllowedException
 * @throws NotFoundException
 * @param string $id
 * @return void
 */
public function admin_delete($id = null) {
if (!$this-request-is('post')) {
throw new MethodNotAllowedException();
}
$this-User-id = $id;
if (!$this-User-exists()) {
throw new NotFoundException(__('Invalid user'));
}
if ($this-User-delete()) {
$this-Session-setFlash(__('User deleted'));
$this-redirect(array('action' = 'index'));
}
$this-Session-setFlash(__('User was not deleted'));
$this-redirect(array('action' = 'index'));
}
}


I also have the Alexo's ACL plugin in place, but the pages, when trying to 
access, are blank.

Everything works fine locally.

I appreciate your help !

Thanks!

Martin

On Wednesday, January 2, 2013 12:29:32 PM UTC-5, Paulo Braga wrote:

 Post your AppController and UsersController(login method), and a 
 screenshot of your users table.

 On Monday, December 31, 2012 11:40:48 PM UTC+2, Martin Halla wrote:

 Hi,

 I have this app that uses the Auth component for login Everything works 
 on the local machine, but fails big time live at :

 http://ncln.halladesign.com

 Can you tell me why ?

 Here are more details :

 user : te...@test.com 
 password : password
 acl plugin by alexo

 Thanks!



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php

Cake 2.2 Auth login failure

2012-12-31 Thread Martin Halla
Hi,

I have this app that uses the Auth component for login Everything works on 
the local machine, but fails big time live at :

http://ncln.halladesign.com

Can you tell me why ?

Here are more details :

user : t...@test.com 
password : password
acl plugin by alexo

Thanks!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: how to implement Smarty 3?

2012-11-19 Thread Martin Aguilar
Correct me if I am wrong.
Bootstrap looks nice but it's not comparable with Smarty for what I could 
see. 
In fact, both of them can be combined. 

I choose smarty because I can take some limit control on giving themes to 
users or clients. Good cache administration, fast rendering, clean code 
over  php tags for printing messages or binding data. 
div?php echo 'something'; ?/div
vs
div{$something}/div

Angular also has a different purpose.
Thank's for the answer, I will take a good and deep look into these two 
frameworks. Even though It's not what I'm looking for right now.


El domingo, 18 de noviembre de 2012 22:05:19 UTC-3, romel javier gomez 
herrera escribió:

 hi, 

 for cool views can use this framework http://twitter.github.com/bootstrap/ 
 and cakephp views.

 And check this to http://angularjs.org/

 regards

 2012/11/17 Martin Aguilar martin...@gmail.com javascript:

 For years I've been working on my own framework but now I wan't to 
 migrate to cakephp. 
 On my framework I used smarty for themes and to separate code from views. 
 I always find smarty clean, nice and with a very good performance.
 Now I want to use it on cake but I found people saying that it has no 
 purpose.
 And couldn't find a good article about implementing it. The only thing 
 that I found it's for cake 1.3 and smarty 2 and the article it's damage.

 http://bakery.cakephp.org/articles/tclineks/2006/10/27/how-to-use-smarty-with-cake-smartyviewOn
  point 4, I see a lot of unreadable symbols.

 Any help on implementing smarty 3 on cake 2?
 What it's your opinion on implementing smarty or any other template 
 system?

 Thanks a lot

 -- 
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP
  
 --- 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 cake-php+u...@googlegroups.com javascript:.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.
  
  




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




how to implement Smarty 3?

2012-11-18 Thread Martin Aguilar
For years I've been working on my own framework but now I wan't to migrate 
to cakephp. 
On my framework I used smarty for themes and to separate code from views. I 
always find smarty clean, nice and with a very good performance.
Now I want to use it on cake but I found people saying that it has no 
purpose.
And couldn't find a good article about implementing it. The only thing that 
I found it's for cake 1.3 and smarty 2 and the article it's damage.
http://bakery.cakephp.org/articles/tclineks/2006/10/27/how-to-use-smarty-with-cake-smartyviewOn
 point 4, I see a lot of unreadable symbols.

Any help on implementing smarty 3 on cake 2?
What it's your opinion on implementing smarty or any other template system?

Thanks a lot

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Are Custom find types limited for my use case?

2012-03-20 Thread martin frances

Hi All,

I am having trouble implementing a custom find method in cakephp 2.1.0

My 'use case' is to cache a common pagination request ..using a custom find 
type.

So in my model I define my custom find :-

public $findMethods = array('primeimages' = true);

protected function _findPrimeimages($state, $query, $results = array()) {

switch ($state) {

case 'before':

// Check if cache has results exists. If so return false

// ( cached result can be inserted by afterfind().

return false; // query is not killed !

break;

case 'after':

// if results empty insert results from cache.

return $results;

break;



}

}

I have problems :-

1) In a normal beforeFind() function I would be able to kill the find by 
returning false... this does not work for custom find type.

2) the beforeFind() and afterFind() funcitons are no longer called..

Am I correct in concluding I can not longer kill the actual find while 
using custom find types..

this seems limiting..

Martin

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


Why are file names now CamelCased?

2011-11-03 Thread Martin Bean
Having been a long-time user of CakePHP 1.3, I was wondering why file and 
folder names are now CamelCased rather than just being lowercase and 
underscored?

Personally, I'm a fan of using lowercase and underscores in filenames (then 
CamelCase in my actual class declarations) so this change is pretty jarring 
to me.

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


cakedc search plugin - slash disapears in search

2011-03-11 Thread martin
hi

i habe installed the cakedc search plugin.

if i search for a string with a slash / inside, the string is aborted
just  before the /

Example:
-
search string: name = this is the / search string

in the sql appears: WHERE `name` =  `this is the`

Question:
-
what do i have to change please, to get the whole string to the query?

Regards
Martin

-- 
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: how to all a function from a controller action

2011-03-05 Thread martin
thank you very much!


On 4 Mrz., 19:01, cricket zijn.digi...@gmail.com wrote:
 On Fri, Mar 4, 2011 at 11:24 AM, martin mschenk@gmail.com wrote:
  hi
  i'm new to cakephp, but i know about php.
  i didn't get the mvc concept 100% up to now, sorry.

  where do i have to place a function which i want to call from inside
  an action of a controller?
  i have an import action in the pages controller
  and need to call several times my oen function convertdate() from
  inside the action import.

  do i have to resolve that with a component? or in a model?
  where and how do i have to place this function please and how do i
  have to call the function from inside my controller action import?

 You should probably put it inside a model. If it's not specific to a
 single model, put it in AppModel. Then call it like so:

 $this-YourModel-yourMethod()

 But if it's not really something that should belong to a model (eg. a
 generic utility function) put in bootstrap.php and call it like a
 normal function.

  i also would apreciate links to tutorials, where i can undertand with
  examples, how to create own  behaviors, components and helpers. i was
  reading the cakebook, but o would prefer more concrete examples.

 I continue to learn quite a bit from Teknoid's site. Also, the Bakery,
 but there's quite a bit of code that's questionable, too. Check the
 comments, always.

 And, no matter what you're looking at online, pay close attention to
 the date it was posted and any version numbers mentioned. Cake has
 gone through some big API changes.

 http://nuts-and-bolts-of-cakephp.com/http://bakery.cakephp.org/

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


cakedc search plugin -

2011-03-05 Thread martin
this question belongs tu the cakedc search plugin:

i want to populate a query method search field dropdown with the
last selected value, when a search query is fired and the form and
list shows again.

regards from spain
martin

-- 
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: cakedc search plugin -

2011-03-05 Thread martin
resolved!

i forgot to place the field in the $presetVars array
array('field' = 'mes', 'type' = 'value'),

now it works perfect.



On 5 Mrz., 18:28, martin mschenk@gmail.com wrote:
 this question belongs tu the cakedc search plugin:

 i want to populate a query method search field dropdown with the
 last selected value, when a search query is fired and the form and
 list shows again.

 regards from spain
 martin

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


cakedc search plugin - two queriy types in $filterArgs

2011-03-05 Thread martin
cakedc is a great plugin.
i need two query types in $filterArgs

-code-
public $filterArgs = array(
array('name' = 'name', 'type' = 'like'),
array('name' = 'jahr', 'type' = 'query', 'method' =
'zeitSpanneJahr'),
array('name' = 'mes', 'type' = 'query', 'method' =
'zeitSpanneMes'),
);

public function zeitSpanneMes ( $data, $field = null){...  }

public function zeitSpanneJahr ( $data, $field = null){ ...  }
--code-end---

the problem is, that only the second query is included in the total
search query.

what do i have to do please, to get both queries.
i want to conect them with AND

regards from spain
martin



-- 
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: cakedc search plugin - two queriy types in $filterArgs

2011-03-05 Thread martin
i solved it up to now with one query, where i put everything inside
what i need.
but it's not a perfect solution, but it works.


On 5 Mrz., 19:13, martin mschenk@gmail.com wrote:
 cakedc is a great plugin.
 i need two query types in $filterArgs

 -code-
 public $filterArgs = array(
                 array('name' = 'name', 'type' = 'like'),
                 array('name' = 'jahr', 'type' = 'query', 'method' =
 'zeitSpanneJahr'),
                 array('name' = 'mes', 'type' = 'query', 'method' =
 'zeitSpanneMes'),
 );

 public function zeitSpanneMes ( $data, $field = null){    ...  }

 public function zeitSpanneJahr ( $data, $field = null){     ...  }
 --code-end---

 the problem is, that only the second query is included in the total
 search query.

 what do i have to do please, to get both queries.
 i want to conect them with AND

 regards from spain
 martin

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


how to all a function from a controller action

2011-03-04 Thread martin
hi
i'm new to cakephp, but i know about php.
i didn't get the mvc concept 100% up to now, sorry.

where do i have to place a function which i want to call from inside
an action of a controller?
i have an import action in the pages controller
and need to call several times my oen function convertdate() from
inside the action import.

do i have to resolve that with a component? or in a model?
where and how do i have to place this function please and how do i
have to call the function from inside my controller action import?

i also would apreciate links to tutorials, where i can undertand with
examples, how to create own  behaviors, components and helpers. i was
reading the cakebook, but o would prefer more concrete examples.

regards, martin


-- 
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: file upload with miles johnsons upload plugin - without model

2011-02-25 Thread martin
thank you very much.

On 24 Feb., 19:32, Miles J mileswjohn...@gmail.com wrote:
 Your form is posting to a completely different url. Try setting this:

 echo $form-create('Model', array('type' = 'file', 'url' =
 array('controller'='pages','action'='display', 'upload')));

 On Feb 24, 9:05 am, soymartinus mschenk@gmail.com wrote:

  Hi
  i'm new to cakephp and can't get miles johnsons upload plugin 
  (http://www.milesj.me/resources/script/uploader-plugin) to work.

  i don't use/need a database for the upload form.
  so i created the upload.ctp in app/views/pages

  echo $form-create('Model', array('type' = 'file'));
  echo $form-input('fileName', array('type' = 'file'));
  echo $form-end('Upload');

  and added to the pages_controller the
  function upload() like explained in the tutorial on miles webpage.

  in routes.php i put
  Router::connect('/upload',
  array('controller'='pages','action'='display', 'upload'));

  thats what i added to the pages_controller:

  //uploader plugin
  var $components = array('Uploader.Uploader');
  var $actsAs = array('Uploader.FileValidation');

  function upload() {
          //http://www.milesj.me/resources/script/uploader-plugin
          $this-set('testvar', hello world);
          $this-Uploader-uploadDir = 'files/uploads/';
          $this-Uploader-enableUpload = true;
          $this-Uploader-maxFileSize = '8M'; // 8 Megabytes
          $this-Uploader-maxNameLength = 40;
          //$this-Uploader-mime('image', 'gif', 'image/gif');
          //$this-Uploader-delete('files/uploads/filename.jpg');

          if (!empty($this-data)) {
                  if ($data = $this-Uploader-upload('fileName', 
  array('overwrite' =
  true, 'name' = 'new_fileName'))){
                          debug($data);
                  }
          }

  }

  when i now want to upload a file, i get always the error:
  Error: ModelsController could not be found.

  thank you very much in advance for any help

  regards from spain, martin

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


$this-Html-link with javascript back()

2011-02-25 Thread martin
can't find out how to resolve:

a href=javascript:history.back()go back/a

with:

$this-Html-link




-- 
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: I am getting an error like this after i submit an action.

2011-01-10 Thread Martin Duris
Hello,

you are put something on output - write something on document (maybe
something in controller ..) and than you are trying to redirect - this cause
error, becose you can redirect after you put something on document

as i see, you have problem in model file ... sometimes hapens to me too (and
this err makes me crazy grr) ... often is made, when you made some blank
space in model file (post.php), you can try to create new model file (don`t
copy, write new...) and check you controller, if you don`t write something

2011/1/10 Jeremy Burns | Class Outfit jeremybu...@classoutfit.com

 More specifically, you are probably trying to echo something screen, which
 is causing this error.

 Jeremy Burns
 *Class Outfit*
 *
 *
 jeremybu...@classoutfit.com jeremybu...@mac.com
 http://www.classoutfit.com

 On 10 Jan 2011, at 11:53, Amit Badkas wrote:

 Hi,

 The error message itself has information for file and line number 
 ('C:\xampp\htdocs\todo\app\models\post.php:9')
 you need to look at.

 Amit Badkas

 PHP Applications for E-Biz: http://www.sanisoft.com



 On Mon, Jan 10, 2011 at 5:09 PM, Deepak test05041...@gmail.com wrote:

 Warning (2): Cannot modify header information - headers already sent
 by (output started at C:\xampp\htdocs\todo\app\models\post.php:9) [CORE
 \cake\libs\controller\controller.php, line 742]
 Code | Context

 $status =   Location: http://localhost/todo/posts;

 header - [internal], line ??
 Controller::header() - CORE\cake\libs\controller\controller.php, line
 742
 Controller::redirect() - CORE\cake\libs\controller\controller.php,
 line 721
 PostsController::delete() - APP\controllers\posts_controller.php, line
 64
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
 [main] - APP\webroot\index.php, line 85



 please help me as i want to finish it of as early as possible.

 Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en



 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en


  Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Login Redirect Problem

2011-01-08 Thread Martin Duris
interesting ...

maybe, you can try (not very clever and effective way) :
after login redirect user to 'Redirect_page' (for both groupd) - with
standart Auth functionality ... there, dont create view ... just in controll
function define redirecting according to group -

it will look like this :

Login Page with formular - Automatic Login Page (without view - just
redirect user to correct page) - Correct page
users/login - users/logged_user - users/page1 OR users/page2

2011/1/8 eldorado2768 davidbrotman2...@gmail.com

 I tried your suggestion. I created the before filter in the app
 controller as shown below:

 class AppController extends Controller {

 var $helpers = array('Form', 'Html', 'Javascript',
 'Time','Menu','Session');
 var $components = array('Acl','Auth','Session');

 #  //Configure AuthComponent
 function beforeFilter() {
  $this-Auth-authorize = 'actions';
  $this-Auth-loginAction = array('controller' = 'users', 'action' =
 'login');
  $this-Auth-logoutRedirect = array('controller' = 'users', 'action'
 = 'login');
 $groupmember = $this-Session-read('Auth.User.group_id');
 if($groupmember=='1')
 $this-Auth-loginRedirect = array('controller' = 'users', 'action'
 = 'index');
 else
 $this-Auth-loginRedirect = array('controller' = 'tenants', 'action'
 = 'tenantview');
  }
 }

 This produces a much more serious error with the whole page going
 white:

 Warning (512): AclNode::node() - Couldn't find Aro node identified by
 Array
 (
[Aro0.model] = User
[Aro0.foreign_key] = 4d2508cb-cd40-48c6-b93d-40c945591691
 )
  [CORE/cake/libs/model/db_acl.php, line 191]


 On Jan 7, 2:53 pm, Martin Duris mato.du...@gmail.com wrote:
  i guess, problem might be here :
  in app_controller you define login redirect (according to standart use of
  Auth from tutorial)
 
  $this-Auth-loginRedirect = array('controller' = 'projects', 'action'
 =
  'index');
 
  you should take care of login redirect here (maybe edit it or bypass)
 
  2011/1/7 eldorado2768 davidbrotman2...@gmail.com
 
   I am trying to redirect to different locations depending on which
   group a user belongs to after logging in. The problem I am having is
   that it keeps going to the redirect for group 1 even when it should be
   going to the redirect for group 2:
 
   function login()
{
   $this-layout = 'login';
   if ($this-Auth-user())
{
   $groupmember = $this-Session-read('Auth.User.group_id');
   if($groupmember==1)
   $this-Auth-loginRedirect = array('controller' = 'users', 'action'
   = 'index');
   else
   $this-Auth-loginRedirect = array('controller' = 'tenants', 'action'
   = 'tenantview');
}
 
}
 
   I have confirmed that the group_id is being picked up by the session
   variable by displaying it on the redirected view so I know at least
   the variable is not empty.
 
   Anyone have a clue what I am doing wrong here?
 
   Check out the new CakePHP Questions sitehttp://cakeqs.organd help
 others
   with their CakePHP related questions.
 
   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
   cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.com
 cake-php%2bunsubscr...@googlegroups.comcake-php%252bunsubscr...@googlegroups.comFor
 more options, visit this group at
  http://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Login Redirect Problem

2011-01-07 Thread Martin Duris
i guess, problem might be here :
in app_controller you define login redirect (according to standart use of
Auth from tutorial)

$this-Auth-loginRedirect = array('controller' = 'projects', 'action' =
'index');

you should take care of login redirect here (maybe edit it or bypass)

2011/1/7 eldorado2768 davidbrotman2...@gmail.com

 I am trying to redirect to different locations depending on which
 group a user belongs to after logging in. The problem I am having is
 that it keeps going to the redirect for group 1 even when it should be
 going to the redirect for group 2:

 function login()
  {
 $this-layout = 'login';
 if ($this-Auth-user())
  {
 $groupmember = $this-Session-read('Auth.User.group_id');
 if($groupmember==1)
 $this-Auth-loginRedirect = array('controller' = 'users', 'action'
 = 'index');
 else
 $this-Auth-loginRedirect = array('controller' = 'tenants', 'action'
 = 'tenantview');
  }

  }

 I have confirmed that the group_id is being picked up by the session
 variable by displaying it on the redirected view so I know at least
 the variable is not empty.

 Anyone have a clue what I am doing wrong here?

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Route question

2010-08-30 Thread Harald Martin Bråttbåkk
Hello,

i simply want to change the default routing pattern http://
example.com/controller/action/param1/param2/param3 into http://
example.com/param1/controller/action/param2/param3. Is there a simple
way to do this?

Regards

Harald

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakePHP 1.3 setup on Ubuntu

2010-08-25 Thread The Brian Martin
What does your .htaccess look like?




On Aug 24, 12:22 pm, david david.fi...@gmail.com wrote:
 First, let me say I have CakePHP up and running perfectly on windows
 with a wampserver instance running, so I'm familiar with the process.
 I know how to get mod_rewrite setup, and set the permissions
 appropriately, etc.

 So, I just installed Ubuntu server 10.04 / Apache 2 / MySQL / PHP, and
 I'm now trying to get CakePHP setup. I've seen plenty of posts
 outlining getting setup on Ubuntu, because the debian arrangement of
 Apache config files can be confusing to those not familiar with it.
 I've used Debian for a long time, so I'm good on that front.

 Basically, my problem is the 404 error for cake.generic.css and
 cake.power.gif, which everyone says is caused by a mod_rewrite
 problem. I have tested mod_rewrite separately and it works fine, so I
 know it's running and working.

 I've tried the following in my sites-enabled (basically a snippet of
 what would be part of httpd.conf on most other systems):

         DocumentRoot /var/www/cakephp
         Directory /
                 Options FollowSymLinks
                 AllowOverride All
                 allow from all
         /Directory
         Directory /var/www/cakephp
                 Options Indexes FollowSymLinks MultiViews
                 AllowOverride All
                 Order allow,deny
                 allow from all
         /Directory

 I've changed the directories to /var/www; I've recursively changed the
 owner of /var/www to www-data and set permissions to 755, and
 recursively set 777 to app/tmp.

 I'm a bit stumped and have no idea why it's not working. Any thoughts?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: compleax query

2010-06-21 Thread Martin Radosta

If you fallow the naming convetion, conditions should be:

'cp.id = CampaignStoreDate.campaign_id'

AND

'Store.id = CampaignStoreDate.store_id'



Can you send us the resulting SQL? (debug level 2)


Thanks

MARTIN



On 06/21/2010 09:21 AM, rakeshyadav rakeshyadav wrote:

Hi All,

  i am trying to execute complex query like this,


  $storeDates =   $this-CampaignStoreDate-find('all',
array('joins' =  array(
 array(

'type'  =  'INNER',

'table' =  'campaigns',

'alias' =  'cp',

'foreignKey' =  false,

'conditions' =  array(

'cp.campaign_id = CampaignStoreDate.campaign_id')
   ),
 array(

'type'  =  'INNER',

'table' =  'stores',

'alias' =  'Store',

'foreignKey' =  false,

'conditions' =  array(

'Store.store_id = CampaignStoreDate.store_id')
)
 ),
   'conditions' =
array(
 'CampaignStoreDate.date between ? and ?'=
array($strDate,$endDate),
 )));
in this i am using 3 tables  CampaignStoreDate ,campaigns,stores the
condition what i am checking is working fine the array format i am
getting is,
 Array
(
 [0] =  Array
 (
 [CampaignStoreDate] =  Array
 (
 [campaign_store_id] =  381
 [campaign_id] =  87
 [media_id] =  4
 [store_cluster_id] =  0
 [store_id] =  2
 [date] =  2010-06-15
 [active] =  0
 [deleted] =  0
 )

 [Store] =  Array
 (
 )

 [Campaign] =  Array
 (
 )

 )

 [1] =  Array
 (
 [CampaignStoreDate] =  Array
 (
 [campaign_store_id] =  388
 [campaign_id] =  105
 [media_id] =  2
 [store_cluster_id] =  0
 [store_id] =  10
 [date] =  2010-06-15
 [active] =  0
 [deleted] =  0
 )

 [Store] =  Array
 (
 )

 [Campaign] =  Array
 (
 )

 )

)

in this Store and Campaign tables data is not coming i nead Store data
in my view file help me.

Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to add a relationship whit other key different to the PK

2010-05-12 Thread Martin Westin
Sorry for not noticing your reply until now.

In that case you might get away with simply telling the relationship
that the foreign key is software_id.




On Apr 28, 4:02 pm, Manolet Gmail mano...@gmail.com wrote:
 the problem is that i need to user the value of software_id for the query.

 for example, the HasMany query should be:

 SELECT `Mirror`.`id`,   FROM `mirrors` AS `Mirror` WHERE
 `Mirror`.`software_id` = (6)

 But how i can put in the query, or in the conditions value add the id of
 software_id??

 Thanks in advance

 On Wed, Apr 28, 2010 at 4:35 AM, Martin Westin
 martin.westin...@gmail.comwrote:





  You can set foreign_key to false and instead use the condition of the
  relationship. This is usually used for things like User.active = true
  and simple things like that but I think it can be used for your
  purpose.

  COme to think of it, I may be wrong. I vaguely recall an RC for
  Cake1.2 causing problems when the condition is not an array... and I
  think you might need a string contition.

  On Apr 28, 12:54 am, Manolet Gmail mano...@gmail.com wrote:
   Hi, i have this tables:

   Software
   Reviews
   Mirror
   Requirements
   Published

   Now, this is the relations:

   Software Has Many Reviews
   Software Has Many Mirrors
   Software HABTM Requirements

   Works fine.

   The problem is that i need to resume the tables to get a better response
   from mysql, the reviews tables have text fields and are classified by
   language, so, for the public site i do a Published table for each
  language,
   i mean: language_en language_es language_fr and load the data
  automatically
   into that tables...

   The Published table is a merge of the Software and Review Table. The PK
  of
   Published table is 'id', and is the same number of the reviews table.

   I want to establish this relationship: Published.software_id (not the PK)
   Has Many Mirrors.software_id

   The key has a Unique index, the problem is that aparently i can use the
   foreign_key attribute when declaring the relationship to set the Mirror
   model field, but i cant set the field that i want to use on the Published
   model, it uses the PK by default.

   Is there a way to force it to use other key different to the PK for the
   queries?

   Currently im using afterFind function and works okey, but dont allows me
  to
   use contain or fields.

   Hope you can understand me and help me

   thanks for you time,

   Manolo

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
  with their CakePHP related questions.

   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
   cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c
omFor more options, visit this group athttp://
  groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
  with their CakePHP related questions.

  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
  cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c 
  omFor more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Display Blob from db

2010-05-12 Thread Martin Radosta

An approach

in the controller:

function show_image($recordId) {
$this-set('data', $this-Model-findById($recordId));
$this-layout = 'ajax'
}


the view show_image.ctp:

Configure::write('debug', 0);
header(Content-type: image/jpeg); //assume jpg image
echo $data['Model']['blob_file'];


your view:

echo $html-tag('img', array(
'src' = Router::url(array('controller' = 'your_controller', 
'action' = 'show_image', $userInfo['Photo'][0]['id']))

)
);


Regards

MARTIN



On 05/13/2010 12:26 AM, Ed Propsner wrote:
Besides the size there should be no diff between binary and blob, 
I was just thinking that perhaps Cake handled them differently.
I played around with media view and it doesn't seem to be what I'm 
looking for.


I have it narrowed down to the headers and I can get the photo to 
display but it has to be in it's own view and even then I have to echo 
the image directly in the controller action ... this isn't working for 
me. I never usually store photos directly to the database but in this 
instance i feel it better serves my purpose without taking a hit on 
performance.


Ideally I would like to access the image through it's $hasMany assoc 
and nest it in an image tag but I'm at a loss for how to pull that off 
with Cake.




On Wed, May 12, 2010 at 3:12 PM, Ed Propsner crotchf...@gmail.com 
mailto:crotchf...@gmail.com wrote:


I've been toying with this one for a while now and I'm not really
getting anywhere.

I'm trying to display a photo stored in db as type blob. With
conventional PHP I would normally store the photo with type
binary and never had any issues ... Blob is not going so well.
I figure the problem has something to do with content type but MVC
is confusing me a bit when it comes to headers or media views. It
seems straightforward enough but I think I'm going about the wrong
way (I'm not using media view or headers at this point).

In my Users Model I set up a $hasMany assoc.

 var $hasMany = array(
'Photo' = array(
'className' = 'Photo',
'foreignKey'= 'user_id',
'conditions'= array('Photo.profile' = 1,
'Photo.private' = 0),
'limit'= '1',
'dependent'= true
)
);

Rendering the photo is the problem.

 View

$html-tag('img', array(
  'src' =
$userInfo['Photo'][0]['file']
 )
)

the file part of the array is empty:

  [Photo] =  Array
 (
 [0] =  Array
 (
 [file] =
 [user_id] =  1
 )

 )

I tried a lot of different things but nothing worked the way I
want. What is the proper way to go about this?

- Ed


Check out the new CakePHP Questions site http://cakeqs.org and help 
others with their CakePHP related questions.


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
cake-php+unsubscr...@googlegroups.com For more options, visit this 
group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Limitations to plugins for app modularity - are there any left in cake 1.3?

2010-05-11 Thread Martin Westin
My experience tells me that almost all of your limitations did not
exist even before 1.3


- plugins couldn't access or extend app's models
They could. I did it regularly.

- code in the app couldn't access a plugin's models
They could. But I would not recommend doing it. (IMHO an app should
not break when a plugin is missing)

- plugin did not have callback capabilities in their appController
like app did (eg. beforeFilter, etc.).
They did.

- plugin's views had no way of integrating with cake's theme'ing
I don't know about themes at all so no comment.

- plugin controllers couldn't be managed by Auth/ACL
Auth: they could. ACL: no idea.

The main gotcha I can think of is the dot notation for targeting
plugins. Pizza.PizzaModel or Pizza.PizzaComponent and similar.

I have an app that is made up almost entirely of plugins. Only login/
logout and statistics and reporting are the visible features
residing in the core.

The one hack I made to the 1.2 core was to let urls get a bit shorter
by not requiring the namespacing part of controllers in plugins. /
pizza/pizza_orders is messier than /pizza/orders But this was purely
cosmetic to get prettier urls.





On May 11, 7:57 am, keymaster ad...@optionosophy.com wrote:
 In the past (cake 1.1, and to an extent cake 1.2)  there were
 limitations to plugins which prevented their use as a means of
 modularizing your app's code.

 For example,

 - plugins couldn't access or extend app's models
 - code in the app couldn't access a plugin's models
 - plugin did not have callback capabilities in their appController
 like app did (eg. beforeFilter, etc.).
 - plugin's views had no way of integrating with cake's theme'ing
 - plugin controllers couldn't be managed by Auth/ACL
 - etc.

 The main reason is that plugins were not originally designed as a tool
 for application modularity, but rather were for sharing functionality
 across apps. So, there was originally no intent to have them integrate
 fully into any app.

 As a result,  many people avoided the use of plugins as a means of
 modularizing their apps, and instead defined  additional paths to all
 the cake pieces using the variables for that purpose in config/
 bootstrap. This way, you could have full modularity without any of the
 limitations of plugins.

 With all the good new development in plugins since cake 1.2 and 1.3,
 in particular the ability to have js/css located inside the plugin
 they apply to,  I am musing over the possibility of converting all my
 additional paths folders over to plugins.

 However, I am scared that I will trip over some unknown plugin
 limitation which will become a showstopper.

 So the question is:  in cake 1.3,  are there still limitations to
 plugins which native app code doesn't have, or are plugins for all
 intents, fully considered as additional controllers/models/views to
 the main app, and can integrate freely as any other app code can?

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Shared SSL and .htaccess

2010-05-11 Thread Martin Westin
Classic problem.
being inside a aliased folder, like ~myuser you need to edit
your .htaccess file adding a rewrite base. Search and find tons of
threads discussing it in detail. (searching is easy once you know the
right keywords)

Once you got that done Cake should work fine.


On May 10, 6:31 am, lavin carloslavi...@gmail.com wrote:
 I've been trying to make my site work with the free shared SSL
 provided by my hosting (bluehost), which is enabled by accessing the
 URLhttps://secure.bluehost.com/~myuser/subdomainfolder/

 I can see that it is working if i remove the .htaccess files used for
 cakephp (the subdomain folder contains a typical cakephp installation,
 app folder, cake folder, etc)... However i just cant get the htaccess
 to work ok with it

 Has anyone ran into this same problem? Got any ideas for the .htaccess?

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Cookie::delete() spits error on one server but not the other

2010-05-11 Thread Martin Westin
I have been scratching my head a bit here and can't find the problem.

$this-Cookie-delete('Auth.User');
...is called on login and logout.

When sometimes the Auth key does not exist in the cookie __values I
get a notice from PHP... but only on my production server. php.ini is
a likely candidate, I just can't find the php.ini setting causing it.
All looks ok to me.

Any ideas?

(Cake 1.3, PHP5.3)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Limitations to plugins for app modularity - are there any left in cake 1.3?

2010-05-11 Thread Martin Westin
I think you are reading two posts as one.

I only mentioned using plugins for all visible features except a very
few... nothing about paths.

And to clarify about the app I refer to:
The app is made up of many plugins.. not one common plugin.
There is a lot of common functionality in the main app... just not
exposed as visible features.
The app is plugin-based to enable quick development of new features
and variations of similar features without changing the central
application.
The main menu simply lists activated plugins + user management and
reporting. Each client may have an infinite variation of plugins
activated based on their contract and needs.
The central app does a ton of model stuff and other validation and
also a fair bit of component things that plugins can make use of.

It is all really very straight-forward... but a bit complicated to
explain. I tried on my website and the bakery a while back:
http://www.eimermusic.com/articles/designing-a-modular-application-using-cakephp-plugins/
http://bakery.cakephp.org/articles/view/designing-a-modular-application-using-cakephp-plugins





On May 11, 2:29 pm, AD7six andydawso...@gmail.com wrote:
 On May 11, 2:25 pm, AD7six andydawso...@gmail.com wrote:





  On May 11, 2:12 pm, keymaster ad...@optionosophy.com wrote:

   Actually, believe it or not, many of these issues did exist, but
   admittedly it was a very long time ago.

   For example, it wasn't until late 2007 (Oct./Nov. timeframe if I
   remember correctly), that the ability for app code to access plugin
   models was introduced into the 1.2 branch through the use of the
   Plugin dot notation. Prior to that it was impossible. Not by
   oversight, but by intention.

   Plugins were intended to remain optional, decoupled code from the main
   app, and were not meant to be a means of organizing similiar
   functionality together.

   As an example of the feeling towards app organization/modularity back
   then, I actually dug up this comment by Gwoo (former Project Manager
   of cake) from late 2007:

   Correct me if I am wrong, but it seems some are using plugins to
   organize parts of a larger application. To me, you are on a slippery
   slope here to basically negating the whole benefit of a plugin and
   just making it more work on yourself. Using the config/bootstrap.php
   to organize your MVC requires a lot less code and should yield the
   same benefits.

   That thread is 
   here:http://groups.google.com/group/cake-php/browse_thread/thread/8526219c...

   So, you can see it was originally intended that plugins were not for
   organizing application code, only for sharing amongst developers. As a
   result there were several limitations to how apps could use, or more
   specifically could not use, plugins.

   While it's true that some plugins are optional and the app should not
   depend on them, other plugins might neeed to be an integral part of
   the app, containing code which was just separated off for the purpose
   of grouping closely knitted functionality together, within the larger
   app. In that sense, models in one plugin might need to have
   associations with models in another plugin. (eg. Order belongs to
   Account, or Order HABTM Warehouse, where accounts, orders, and
   warehouses are all in different plugins).

   The limitations back then (I believed based on discussions in this
   group, though I never tried it) prevented the use of plugins for
   grouping together functionality within the app. So, I and many other
   developers used the additional paths to group things together.

   At some point in cake v.1.2 a number of these limitations were
   removed, and in 1.3 yet more were removed.

   So, I'm wondering now that 1.3 is out, is there still a reason to
   organize apps using the additional paths in config/bootstrap?

  I think it's safe to say that a quote from 2007 isn't fair
  justification for not just trying it. I've used plugins almost as long
  as they've existed and can't remember having any problems at all
  worthy of 'holding back'.

  AD

 PS additional app paths and plugins don't solve the same problem, I'm
 kind of scared what you've been up to if for you they are
 interchangable. For me additional app paths is for using exactly the
 same app with different css  a different db whilst maintaining one
 code base. even so the app contained only auth and user logic and a
 contact form - the rest was in a common plugin.

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their 

cakephp v2.0

2010-05-07 Thread Martin Neuman
Hi all, does anybody knows something about this project? After the
launch of 1.3 stable the core team will move to the v2? Any beta date?
or updated roadmap?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Ajax - Select - On change

2010-05-04 Thread Martin
hellou,

i got little problem.
I have simple form, for example :

form-create('form');

$options[0] = //options for array
$selected[0] = //selected thing
$form-select('profiles',$options,$selected);

and some ajax button :
$ajax-submit('Choose', array( 'update' = 'content'));

just simple, after click on button, ajax request was send, proces and
something displayed  ...

but, i want to change it, to do it right after i change atribute in my
select, mean - when i choose something in select, form will be
submitet throug ajax and something will done (just like after click on
ajax button)

is there any way hot to use ajax onchange ???

thx a lot

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Datasource CouchDB

2010-04-28 Thread Martin Westin
This is not an answer as such, only an idea if there is no datasource
already.
If you feel a bit adventurous you might be able to sneak a peek at the
MongoDB datasource and make a similar one for CouchDB. The two
databases are not identical but I think significant parts of the
datasource would be similar.

http://github.com/ichikaway/mongoDB-Datasource



On Apr 27, 9:41 pm, Maury maurymmarq...@gmail.com wrote:
 Someone has a datasource for CouchDB cakePHP that works like 
 this?http://book.cakephp.org/view/1077/An-Example

 Thanks

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: how to add a relationship whit other key different to the PK

2010-04-28 Thread Martin Westin
You can set foreign_key to false and instead use the condition of the
relationship. This is usually used for things like User.active = true
and simple things like that but I think it can be used for your
purpose.

COme to think of it, I may be wrong. I vaguely recall an RC for
Cake1.2 causing problems when the condition is not an array... and I
think you might need a string contition.


On Apr 28, 12:54 am, Manolet Gmail mano...@gmail.com wrote:
 Hi, i have this tables:

 Software
 Reviews
 Mirror
 Requirements
 Published

 Now, this is the relations:

 Software Has Many Reviews
 Software Has Many Mirrors
 Software HABTM Requirements

 Works fine.

 The problem is that i need to resume the tables to get a better response
 from mysql, the reviews tables have text fields and are classified by
 language, so, for the public site i do a Published table for each language,
 i mean: language_en language_es language_fr and load the data automatically
 into that tables...

 The Published table is a merge of the Software and Review Table. The PK of
 Published table is 'id', and is the same number of the reviews table.

 I want to establish this relationship: Published.software_id (not the PK)
 Has Many Mirrors.software_id

 The key has a Unique index, the problem is that aparently i can use the
 foreign_key attribute when declaring the relationship to set the Mirror
 model field, but i cant set the field that i want to use on the Published
 model, it uses the PK by default.

 Is there a way to force it to use other key different to the PK for the
 queries?

 Currently im using afterFind function and works okey, but dont allows me to
 use contain or fields.

 Hope you can understand me and help me

 thanks for you time,

 Manolo

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Bakery...arrogance or plain lack of attention

2010-04-26 Thread Martin Westin
I have a few articles published in the Bakery. This does not make me
an authority on the subject but Since my first one was back in 2007 (I
think), before it was even called the Bakery, I do have some
experience of it over a pretty long time.

My personal set of guidelines for writing articles are:
- Write and edit, preview and check... a lot.
- Only publish once. Don't ever edit a published post unless you are
at gunpoint.
- Instead post additions or edits as author comments.
- Keep the rss feed of comments to each of your articles in your feed
reader.
- Respond to real comments and delete spam comments. (I only delete
spam I am certain of)

I have developed some of this due to the sometimes very slow
moderation process. A spell-correction once lingered for many weeks.
This is of-course frustrating. But, if everyone took great care to
check their articles before publishing their content I believe the
process would be significantly quicker.
Other points in my list are there to improve the quality of the
article and to take on a small part of the burden of comment
moderation. By keeping track of comments and responding to them you
improve the quality of your article and the Bakery as a whole. Even if
it is just a tiny improvement, it is something everyone can do. No
forking required. ;)

I believe that the main problems that need to be addressed in the
software are related to spam. It if not perfect in most other
respects, few things are, but the spam comments are the most urgent
problem. They also take up a lot of time, I imagine.
(There is also the thing where an author can't delete his/her own
articles.)

The other frustrations I have experience from time to time are
probably more due to human resources, or a shortage thereof. It is
important to point out that the people involved are NOT the problem...
the rest of us, not involved, are so to speak.
I am sure that with more insight one could see ways of improving the
software that would streamline the work of moderators.


/Martin



On Apr 26, 3:10 am, Graham Weldon gra...@grahamweldon.com wrote:
 Most definitely. We're keeping pretty busy with work on the core at the
 moment, with releases for 1.2.7 and 1.3.0 out recently, we have a fair load
 of work ahead to push through on CakePHP 2.0.

 If anyone has an interest in developing and working on the bakery, we would
 very much welcome it.

 Cheers,
 Graham Weldon (aka. Predominant)





 On Mon, Apr 26, 2010 at 10:49 AM, jacmoe jac...@mail.dk wrote:
  I think you misunderstand:
  When you make a fork of a project on Github, you can make merge
  requests back.
  Which means that if you're unsatisfied with the Bakery (as software),
  just fork it, fix it, and make a merge request.
  Even for small fixes, doesn't matter.
  I am sure Graham and Mark and the rest of the CakePHP team would
  appreciate that. :)

  That's what I mean by forking.

  Cheers

  Jacob

  On Apr 26, 2:04 am, calvin cal...@rottenrecords.com wrote:
   I haven't published anything on the Bakery except for comments, so I
   can't comment on the process. However, I will note that the software
   is pretty screwed up. All my article reply notifications are blank e-
   mails--not even a link to the comment/article. I personally hate it
   when people send me e-mails or make forum posts where they don't write
   anything in the message body and just use the subject-line as the
   message. And I think this, along with dead links in the Cookbook, both
   make Cake look very unprofessional.

   But I don't think just forking the Bakery is a solution. Cake needs a
   centralized/official article/plugins repository. There are just a few
   things that need to be fixed is all. Even if someone were to fork the
   Bakery, it would not be as successful/useful. The Bakery is only so
   useful today because lots of people know about and use it--it's linked
   to right from the CakePHP homepage. So this if you don't like it,
   just fork it attitude is not appropriate. It's similar to the
   attitude that, if you find Cake's documentation lacking, you should
   write it yourself. FOSS is about cooperation and free exchange of
   ideas and information. It's not an excuse to deflect all criticism or
   pin all responsibilities on the user/critic.

   And a person does not need to have contributed to Cake's source code
   to level a valid criticism.

   On Apr 25, 2:46 pm, jacmoe jac...@mail.dk wrote:

That doesn't give you carte blanche to be arrogant, does it?

What have you done for CakePHP if I may ask? :)

A couple of weeks ago I posted this topic:
 http://groups.google.com/group/cake-php/browse_thread/thread/e3a1f469...
With the title 'Let's get rid of The Bakery'.

I volunteered as a moderator, but there's still lots of things to do.
And the software itself needs some fixing.

Feel free to fork it.

I would probably delete the article as well, if there haven't been any
response in three months - I don't know

Re: virtual fields in conditions

2010-04-26 Thread Martin Radosta

2 others work around:
- create a view
- select from a subquery instead quering directly to the table.

Hope this helps.

MARTIN



On 04/26/2010 01:05 PM, jharris wrote:

Okay, so I figured out why I can't reference the alias in the WHERE
conditions: it's just a MySQL restriction.

As for using virtual fields in conditions, I've come to the conclusion
that the current version of Cake does not handle them.

Hope this information is helpful to someone.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


1.3rc4 and saveAll, strange return values

2010-04-21 Thread Martin Westin
I wanted to get some input on the return I get from Model::saveAll().
(I am on 1.3 RC4)

When trying to save multiple records of the same model things did not
save at all at first due to the new validation default. I needed
individual validation so that correct records would save but invalid
ones would be tossed.

So I have added validate true like so:
$this-Modename-saveAll($this-
data['Modename'],array('validate'=true));

Problem is I now expected an array of return values, one for each
record as hinted at (somewhere, can't find it now) but I all I get is
false. Even though 3 out of 4 records are saved. I was under the
impression that saveAll would return an array for these partial
successes. Perhaps not?

With validate set to first I do get an array back... but only an empty
one.

Is this a bug and should have a ticket or is there just some confusion
in the way I have read the docs?

thanks
Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: mac users, which ide are you using to develop cakephp?

2010-04-19 Thread Martin Westin
No ide, just Textmate for me.



On Apr 19, 6:14 am, Bryan Lim ytbr...@gmail.com wrote:
 Hi all,

 mac users, which ide are you using to develop cakephp? to compile and
 to debug?

 I search the group here and realised this discussion is dated back to
 2009. So, I want to know if there's any changes?

 thanks,
 Bryan

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: composite keys to identify a record

2010-04-19 Thread Martin Westin
In conclusion @Renan:
Composite keys are a very normal part of database design but not in
any way supported or very compatible with CakePHP.

Either you have to access that data via your own queris (no find and
save), not use the core Schema Shell to dump the schema ,and a bunch
of other things you loose.

Or, as suggested, you complicate your schema a tiny bit by adding an
extra id field and get to use all the cake stuff.


Just my 2¢
I have only once found it preferable to stick to a multi-key (or zero-
key in that case) table. That table is a WORM table for reporting data
containing only a single data field and about 10 foreign keys. Since
the object is to pull stats you will never ever find a single
record. You will group on the various keys in different combinations
to get graph data. Cake can be forgiven for not supporting that kind
of table.

Personally I think the classic HABTM joining table would haven been
more worthy of support, seeing as there are so many of them in any
given app. But I feel the topic has been discussed to death before. I
don't want to start another discussion about database-religion.

/Martin


On Apr 18, 12:07 pm, Jeremy Burns jeremybu...@me.com wrote:
 And Cake will just 'deal with it', without you having to do any work.

 Jeremy Burns
 jeremybu...@me.com

 On 18 Apr 2010, at 11:04, j0n4s.h4rtm...@googlemail.com wrote:





  Hello,

  for instance you could have Post, Tag, PostTag, Post HABTM Tag / Post
  HasMany PostTag, Tag HasMany PostTag.
  why this example? because it shows the most common place where you
  would - outside of Active Record - use a combined primary key -
  PostTag would have PrimaryKey(post_id, tag_id) - but as Jeremy Burns
  pointed out: besides the very tiny data overhead, what is the issue
  with one additional field as a primary and setting Unique(post_id,
  tag_id)?

  On Apr 17, 12:50 am, Jeremy Burns jeremybu...@me.com wrote:
  I absolutely endorse a single, incremental, non-intelligent primary key, 
  enriched with multi-field unique indexes and the adoption of convention. 
  Why make life any more difficult than it is already?

  Jeremy Burns
  jeremybu...@me.com

  On 16 Apr 2010, at 21:29, Renan Augusto wrote:

  Dear,

  Someone must have encountered a situation where a table had
  with composite key.
  what did you do? Since CakePHP recognizes only one field to
  primaryKey!

  In my opinion I see two possibilities:

  1 - not create tables with composite keys. When you need to use
  composite keys to identify a record, create one more field with the
  name ID and put it as primary key.

  2 - forget standardization. Choose one of the fields to put in
  $ primaryKey attribute of the model and when you need to make a
  relationship (or hasMany belongsTo), use to specify the conditions
  other fields that make up the key of the table.

  That's my opinion, please tell her!

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
  with their CakePHP related questions.

  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
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Tip: MongoDB-Datasource undocumented feature

2010-04-16 Thread Martin Westin
I did not know the datasource could do this and almost didn't try it
as a result. Don't make the same mistake.

Yasushi Ichikaway has developed a very nice datasource for MongoDB.
http://github.com/ichikaway/mongoDB-Datasource/

Mars Story wrote a very nice intro post about it.
http://mark-story.com/posts/view/using-mongodb-with-cakephp

After looking at the github page and reading Mark's post I was
convinced that only ordinary scalar values were supported by the
MongoDB datasource. The source lists only strings, integers and stuff
as datatypes... not objects, arrays or hierarchies in any form.

The good news is that deep nested arrays of data are supported. THis
is a big deal and I don't want anyone else to give this plugin a pass
just because they draw the same conclusions I did.

From my experience, any field defined in the schema can be an array
and contain any hierarchical data. I have given these fields the
datatype array without an error just to indicate to myself that they
are hierarchies.

I have not been able to just add a new root level field but anything
inside a defined field can have any data structure added to it.

Example:
var $mongoSchema = array(
'some_string' = array('type'='string'),
'data'=array('type'='array'), // just a reminder for me
'created'=array('type'='datetime'),
'modified'=array('type'='datetime'),
);

For this model I can save anything inside data. Like:
$this-data['Modelname']['data']['hello']['world'] = 'cool';

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: the plugins dont work at all

2010-04-16 Thread Martin Westin
Hi,
Plugins do work. I have whole apps build with a limited core and
numerous plugins (22 of them in one case).

I can think of a few details to double-check.

I don't think you should have plugins named in camelCase. Try naming
the folder and the urls you try pizza_order instead. (The plugin in
the manual is simply named pizza btw)

app/plugin/poll/
the plugins folder should be named plugins (with an s). You write it
in singular form without the s in one place.

Plugins must have the equivalent of pizza_app_controller.php and
possible pizza_app_model.php too. Without them the plugin will not be
found. At least that was the case when I started using plugins, it
may have changed but I still have them in each plugin.

The final detail I can think of is some rewrite detail messing with
you. Unlikely but since I never run apps as anything but their own
vhost I can't be 100% how plugins react to being in a subfolder. (as
in localhost/apname/)


Those are all long-shots but they are all I can think of that might be
the cause.
Good luck.
/Martin


On Apr 16, 5:28 pm, islam4hak islamco...@gmail.com wrote:
 hi
 why i cant accses any plugin i create ?

 i make the manual tutorial to create the pizzOrder plugin
 but i cant access to it  /pluginname/controllername/action

 so i bake another plugin but i cant access it to

 app/plugin/poll/
 i tryhttp://localhost/appname/poll/
 it dont work

  Error:  PollController could not be found.

 Error: Create the class PollController below in file: appname
 \controllers\poll_controller.php

 so i download a ready to user plugin and i cant access it to
 ?

 the plugin is AJAX star rating plugin for CakePHP 1.2
 i tryhttp://localhost/appname/rating/

 so what i'm doing wrong ?

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
 their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CouchDB as a datasource

2010-04-15 Thread Martin Kirchgessner
Thanks Jon! Although it's young Lithium sounds very good.

Martin

On Apr 14, 10:39 pm, Jon Bennett jmbenn...@gmail.com wrote:
 Hi Martin,

  If you're interested here is my current try 
  :http://bin.cakephp.org/view/1461894980

  it's not complete and doesn't work...

 If you like Cake's take on MVC and want to stick with php, then the
 fork of Cake 3 Lithium has a pretty stable CouchDB 
 datasourcehttp://rad-dev.org/lithium_bin

 hth (and doesn't miff any cakers for pointing in a different direction!).

 J

 --
 jon bennett -www.jben.net- blog.jben.net

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using remove me as the subject.


CouchDB as a datasource

2010-04-14 Thread Martin Kirchgessner
Hi everyone,


As a year-old CakePHP user (by the way : huge congrats to the core
team for keeping up such a pretty framework!) I'm considering to
replace MySQL by CouchDB. I had a dream where some unpredictable data
wouldn't require ugly schemas :)

So far I tried gwoo's datasource (http://bin.cakephp.org/view/
925615535 - see also the original topic [1])
This is a good start but it assumes that a couchDB database is the
counterpart of MySQL tables. I don't think so, as it's usual in
CouchDB to put a type field in documents : then the counterpart of
the table is rather a couch view (or sometimes show or list) which
picks up document sets. A CouchDB view sound like a good counterpart
to find('all', ...)

I tried to rewrite a datasource (if needed I can publish it on cakebin
today), keeping in mind that it would be tied to a single couchdb
database. BUT I found out that schemas are deeply implemented in the
Model class :/ so Cake started to call my source's listSources,
describe and column methods. Of course I couldn't implement these
methods as my DB doesn't have schemas... I tried to set useTable to
false in the Model but then it won't save anything.

So I'm stuck between a normal CouchDB use (a single DB for my whole
app + calls to views in mind) which doesn't seem cake-friendly and a
working datasource that puts some constraints on DB design.
That's why I would like to discuss it here. Any comments are welcome!


Martin

[1] original topic about cake+couch :
http://groups.google.com/group/cake-php/browse_thread/thread/f0eaa55149d7ddb3/bff40dbc700171f9

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using remove me as the subject.


Re: CouchDB as a datasource

2010-04-14 Thread Martin Kirchgessner
If you're interested here is my current try : 
http://bin.cakephp.org/view/1461894980

it's not complete and doesn't work...


Martin

On Apr 14, 10:56 am, Martin Kirchgessner
martin.kirchgess...@orego.fr wrote:
 Hi everyone,

 As a year-old CakePHP user (by the way : huge congrats to the core
 team for keeping up such a pretty framework!) I'm considering to
 replace MySQL by CouchDB. I had a dream where some unpredictable data
 wouldn't require ugly schemas :)

 So far I tried gwoo's datasource (http://bin.cakephp.org/view/
 925615535 - see also the original topic [1])
 This is a good start but it assumes that a couchDB database is the
 counterpart of MySQL tables. I don't think so, as it's usual in
 CouchDB to put a type field in documents : then the counterpart of
 the table is rather a couch view (or sometimes show or list) which
 picks up document sets. A CouchDB view sound like a good counterpart
 to find('all', ...)

 I tried to rewrite a datasource (if needed I can publish it on cakebin
 today), keeping in mind that it would be tied to a single couchdb
 database. BUT I found out that schemas are deeply implemented in the
 Model class :/ so Cake started to call my source's listSources,
 describe and column methods. Of course I couldn't implement these
 methods as my DB doesn't have schemas... I tried to set useTable to
 false in the Model but then it won't save anything.

 So I'm stuck between a normal CouchDB use (a single DB for my whole
 app + calls to views in mind) which doesn't seem cake-friendly and a
 working datasource that puts some constraints on DB design.
 That's why I would like to discuss it here. Any comments are welcome!

 Martin

 [1] original topic about cake+couch 
 :http://groups.google.com/group/cake-php/browse_thread/thread/f0eaa551...

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Timezone management advice

2010-04-12 Thread Martin Westin
Hi, I have found myself in a position where I need to support correct
times across timezones. I'd love any advice and gotchas from those
experienced in timezone management of a Cake app.

I have gotten a bit bewildered by the complexity by something that
looks to simple on the face of it. I need to support time-conversions
correctly and I don't really see full support for it in either Cake or
PHP.

The Basics:
The server may be in a different timezone from the user and users may
be in different timezones.
Times in incoming data (posts, uploads...) need to be converted to
Server Time.
Times for display need to be converted to Client Time.

Some complexities:
You can't sniff the client timezone from the server-side without
(reportedly unreliable) ip-geolocation lookups from the non-free
providers (reportedly less unreliable). So, I need javascript or I
need to ask the user to choose. I'd like to avoid asking the user.
Some timezones use DST. Some do not.
Dates when DST are in effect vary from location to location... and
(big sigh) year to year.

That is basically the broad view of my knowledge of the problems
involved in time-conversions. Am I making things needlessly
complicated for myself? I really need the timestamps to be correct for
the type of app I am developing. Serious things can happen if they get
screwed up by only an hour. The kind of things that cause multi-
million dollar lawsuits and put companies out of business. I don't
want that. :)

Please fire away with your advice and experience on this topic.
/Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using remove me as the subject.


Re: UTF-8 website problem (database encoding works)

2010-04-07 Thread Martin Radosta

So, you have no problem with the editor encoding, nor files enconding.
The problem is with data saved in database or with the way you retrieve it.

Assume you are using mysql.

1) Make sure you have add this to database.php default array config:
'encoding' = 'utf8'
2) Make sure the table collation is utf (could be uft8_general_ci)
3) Make sure the table is empty
4) Add data through the framework (not phpmyadmin or other). Try a 
simple $Model-save(...

5) Get data through the framework. Try a simple $Model-find('all', ...
6) Give us detailed feedback if it does not work for each step.

Regards

MARTIN


On 04/07/2010 12:34 PM, sebb86 wrote:

Martin

Thank you for helping me!

When i do what you suggest, i see the special chars. (echo 'áéíóúñ£
€';)
But, in your message, i dont see this characters. i only see it in the
e-mail, which i get when someone put a message here.

Greetings.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using remove me as the subject.
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: UTF-8 website problem (database encoding works)

2010-04-07 Thread Martin Radosta

I would say the problem is in static content encoding then.

Assuming the left menu and content is in the same file, try this:

echo 'Mitarbeiter Test Strange_Character' . 'br/';
echo utf8_encode('Mitarbeiter Test Strange_Character') . 'br/';
echo utf8_decode('Mitarbeiter Test Strange_Character') . 'br/';

give us feedback

Regards

MARTIN


On 04/07/2010 03:35 PM, sebb86 wrote:

Martin, cricket

Hello,

   

Assume you are using mysql --  yes
1) Make sure you have add this to database.php default array config:'encoding' =  
'utf8' --  done
2) Make sure the table collation is utf (could be uft8_general_ci) --  done
3) Make sure the table is empty --  everything is ok with the data i save 
or retrieve
   
   

SET NAMES 'utf8'; --  yes, i use this option in when i insert data via 
mysql, it works.
   

So, everything is alright with my database. UFT-8 works with my MySQL
database since i've added encoding =  utf8 to my database.php.
The problem appears on the other parts of the website. To exactly see
the problem, please look at my screenshot: 
http://www.zshare.net/image/747107826f2db2a2/
On the screenshot, green is okay, red is a failure. The language
is german.

Thanks a lot for helping me!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using remove me as the subject.
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: UTF-8 website problem (database encoding works)

2010-04-06 Thread Martin Radosta

Your configuration should work, so must reduce the errors source.
Can you see special characters hard coded in html correctly in the page?
I mean, do not use the database

Leave just this in the head and make sure the file is correctly utf-8 saved

- inside my default.ctp layout file:
and inside ofhead:
[code]
?php echo $html-charset(utf-8); ?
[/code]


In the layout do something like this echo 'áéíóúñ£€'; and send us the 
feedback.


Regards

MARTIN



On 04/06/2010 09:35 AM, sebb86 wrote:

Hello,
instead of umlauts, i see only signs on my website. I think the
problem occurs because i developed with Windows 7 with a tool which is
not UTF-8 compatible and later, i moved the needed files to Ubuntu. To
solve this, i downloaded the Notepad++ Editor. Then i opened all files
and checked Encode in UTF-8 without BOM respectively Convert to
UTF-8 without BOM. But the problem is still present.

My database encoding works with uft-8 (encoding option in database.php
made it possible).

What i've tryed:

- inside my default.ctp layout file:
[code]
?php header('Content-type: text/html; charset=UTF-8') ;?
[/code]
and inside ofhead:
[code]
?php echo $html-charset(utf-8); ?
[/code]

- inside my core.php file:
[code]
Configure::write('App.encoding', 'UTF-8');
[/code]

Apache2 is also set to UTF-8.

I spend about 2 days and cant solve this :(
I'm so frustrated. :/

Can someone help me out of this?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using remove me as the subject.
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: How can Schema Shell create new tables?

2010-03-30 Thread Martin Westin
Also, I can't get the reverse to work either. I.e. update does not
notice that a table should be dropped.
I'd love some help on that also.



On Mar 30, 7:51 am, Martin Westin martin.westin...@gmail.com wrote:
 Hi,
 cake schema run update -f always creates an ALTER TABLE statement.
 So how about when a new table is in the schema?

 I see the code really in DboMysqlBase::alterSchema() for my dbo but
 the same logic was found in the Postgres class. Since I am quite sure
 the Schema Shell would not have been released without the ability to
 handle new tables I assume there is something I don't get.

 So, put me out of my misery, please. I really don't see it.

 I can only see that I would have to manually force a create command
 and supply the table name. This can't be the right way since it would
 not work at all in a deployment situation. Can it?

 thanks for any info you can provide.
 /Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


DataTables, cakePHP, and Pagination through Ajax

2010-03-29 Thread Martin
Has anyone used DataTables with cakePHP, successfully implemented
Pagination through Ajax, and can provide example code?

I am successfully populating the table from cakePHP, but am not
getting the footer line Showing X to Y of Z entries, am not getting
paging, and am not sure how to pass the values iTotalRecords
iTotalDispalyRecords.

Any examples?

Thanks,
Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Broken search on http://book.cakephp.org/

2010-03-29 Thread Martin
Fixed! Thanks guys!!

On Mar 25, 2:25 pm, Martin drmjsom...@gmail.com wrote:
 Have others noticed that the search option onhttp://book.cakephp.org/
 is broken? It no longer returns snippets of text with the search
 results, just basic and repeating titles.

 Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: DataTables, cakePHP, and Pagination through Ajax

2010-03-29 Thread Martin
Jeremy, thanks for your response. I previously used the cakePHP
PaginatorHelper, and even have been able to get client side DataTables
fully working. The issue, is I have over a million rows in my table,
and all processing must be done on the server-side. Plus of course, I
use JQuery (vs Prototype), and want the UI functionality of the
DataTables plug in.

So, you mentioned doing the same in jQuery. Have you specifically
tied cakePHP and DataTables together, and used server-side processing?
I can read the $_REQUEST variables iDisplayStart, iDisplayLength, etc.
on the server when doing a sort, but I am not sure how to tie in
iTotalRecords and iTotalDispalyRecords.

Any help, is appreciated.

Martin

On Mar 29, 12:07 am, Jeremy Burns jeremybu...@me.com wrote:
 Ajax pagination is quite simple - here's a good link using MooTools (I do 
 exactly the same but using JQuery). Also, see the guide. Then look at the 
 pagination section of the book, which spells out the pagination options (such 
 as the footer text you refer to).

 Jeremy Burns
 jeremybu...@me.com

 On 29 Mar 2010, at 07:13, Martin wrote:

  Has anyone used DataTables with cakePHP, successfully implemented
  Pagination through Ajax, and can provide example code?

  I am successfully populating the table from cakePHP, but am not
  getting the footer line Showing X to Y of Z entries, am not getting
  paging, and am not sure how to pass the values iTotalRecords
  iTotalDispalyRecords.

  Any examples?

  Thanks,
  Martin

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

  To unsubscribe from this group, send email to 
  cake-php+unsubscribegooglegroups.com or reply to this email with the words 
  REMOVE ME as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


How can Schema Shell create new tables?

2010-03-29 Thread Martin Westin
Hi,
cake schema run update -f always creates an ALTER TABLE statement.
So how about when a new table is in the schema?

I see the code really in DboMysqlBase::alterSchema() for my dbo but
the same logic was found in the Postgres class. Since I am quite sure
the Schema Shell would not have been released without the ability to
handle new tables I assume there is something I don't get.

So, put me out of my misery, please. I really don't see it.

I can only see that I would have to manually force a create command
and supply the table name. This can't be the right way since it would
not work at all in a deployment situation. Can it?

thanks for any info you can provide.
/Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: cake schema run update gone crazy

2010-03-26 Thread Martin Westin

I'll update the thread with some findings after rooting through the
code a bit.

Looking at the source I found out that -f does not force 'generate'
to create a new schema.. It is used To force generation of all
tables into the schema... but not only that.
It can also be used to force update to ignore the Model classes in the
same way as generate and therefore update a schema generated using the
option.

So, Schema Shell appear to do all the important stuff I need... more
testing will confirm.



On Mar 25, 4:59 pm, Martin Westin martin.westin...@gmail.com wrote:
 Ah. Thanks for the hint.

 I have models for all tables... BUT the schema generator does not find
 them all since some are in plugins and some are in sub-foldes of app/
 models. I guess tables matching these models are the cause of the
 problem.

 So in reality, schema shell is only fully usable in apps that do not
 have plugins, multiple dbs or sub-folders inside models. Oh, and all
 table must follow Cake's conventions to the letter. E.g. can't have a
 table without a pk for example.

 I kind of liked the idea of the schema shell. Being abel to keep just
 one schema file and letting Git do the versioning feel just right next
 to the rails-type schema files. So I guess I will have to start
 plowing the source to see if I can make it behave with my schema after
 a reasonable amount of work.

 /Martin

 On Mar 25, 2:07 pm, Ian M. Jones imijs...@googlemail.com wrote:



  Hi Martin,

  Have you got models defined for all the tables in your schema file?

  If not, running cake schema run update will try to add all the columns 
  for any tables missing model files, so I discovered myself today.

  Regards,

  Ian
  
  IMiJ 
  Ltdhttp://www.imij.co.ukhttp://www.ianmjones.comhttp://twitter.com/ianmj...

  On 25 Mar 2010, at 13:02, Martin Westin wrote:

   I thought I'd give schema migrations a try. But something small must
   be horribly wrong with how I am trying to use the schema shell.

   I run cake schema run update on the database that just generated the
   schema and the shell wants to add all the columns to the tables again.
   That can't be right? What's wrong with my schema that the shell thinks
   all tables are without columns?

   I am on Cake 1.2.6 and Apache2, php5.3, MySQL 5... on a Mac with Snow
   Leopard.

   I tried creating an empty db. I ran a create and it created all
   tables... then I ran update and it again wanted to add all (existing)
   columns to the tables.

   Any ideas?

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
   with their CakePHP related questions.

   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
   cake-php+unsubscr...@googlegroups.com For more options, visit this group 
   athttp://groups.google.com/group/cake-php?hl=en

   To unsubscribe from this group, send email to 
   cake-php+unsubscribegooglegroups.com or reply to this email with the 
   words REMOVE ME as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


non-interactive Schema Shell for deployment?

2010-03-26 Thread Martin Westin
I am almost there with the Schema Shell. Now just one thing remains.
Being able to do run update -f without answering y or n to the
questions.

Is there a non-interactive mode for the Schema Shell? I can't see any
option to do it.

/Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: non-interactive Schema Shell for deployment?

2010-03-26 Thread Martin Westin
Found a shell-based way to automatically answer the question.
http://www.unix.com/shell-programming-scripting/30246-how-give-variable-command-shell-script.html





On Mar 26, 3:41 pm, Martin Westin martin.westin...@gmail.com wrote:
 I am almost there with the Schema Shell. Now just one thing remains.
 Being able to do run update -f without answering y or n to the
 questions.

 Is there a non-interactive mode for the Schema Shell? I can't see any
 option to do it.

 /Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: How to search - A very strange find

2010-03-26 Thread Martin Radosta

try
'recursive' = -1


On 03/26/2010 05:23 PM, amarradi wrote:

I have to correct it because in the that have to be an other value
   

  $this-set('variable', $this-Model1-find('first',array(
 'conditions' =  array('Model1.id' =  $id),
 'recursive' =1,
 'fields' =
array('Model1.id','Model1.title','Model1.description')
 )
 )
 );
 

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or 
reply to this email with the words REMOVE ME as the subject.
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or 
reply to this email with the words REMOVE ME as the subject.


Re: How to search - A very strange find

2010-03-26 Thread Martin Radosta

|Your question is not clear, I guess you need this:

$this-Model1-Behaviors-attach('Containable');
|

$this-Model1-find('first',
array(
'conditions' =  array('Model1.id' =  $id),
'contain' =  array('Model2' =  array('fields' =  
array('Model2.title', 'Model2.description', 'Model2.reservation_status'))),
'fields' =  
array('Model1.id','Model1.title','Model1.description')
)
);


On 03/26/2010 09:10 PM, amarradi wrote:

I have to go to bed good night

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or 
reply to this email with the words REMOVE ME as the subject.
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or 
reply to this email with the words REMOVE ME as the subject.


cake schema run update gone crazy

2010-03-25 Thread Martin Westin
I thought I'd give schema migrations a try. But something small must
be horribly wrong with how I am trying to use the schema shell.

I run cake schema run update on the database that just generated the
schema and the shell wants to add all the columns to the tables again.
That can't be right? What's wrong with my schema that the shell thinks
all tables are without columns?

I am on Cake 1.2.6 and Apache2, php5.3, MySQL 5... on a Mac with Snow
Leopard.

I tried creating an empty db. I ran a create and it created all
tables... then I ran update and it again wanted to add all (existing)
columns to the tables.

Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: cake schema run update gone crazy

2010-03-25 Thread Martin Westin
Ah. Thanks for the hint.

I have models for all tables... BUT the schema generator does not find
them all since some are in plugins and some are in sub-foldes of app/
models. I guess tables matching these models are the cause of the
problem.

So in reality, schema shell is only fully usable in apps that do not
have plugins, multiple dbs or sub-folders inside models. Oh, and all
table must follow Cake's conventions to the letter. E.g. can't have a
table without a pk for example.

I kind of liked the idea of the schema shell. Being abel to keep just
one schema file and letting Git do the versioning feel just right next
to the rails-type schema files. So I guess I will have to start
plowing the source to see if I can make it behave with my schema after
a reasonable amount of work.

/Martin



On Mar 25, 2:07 pm, Ian M. Jones imijs...@googlemail.com wrote:
 Hi Martin,

 Have you got models defined for all the tables in your schema file?

 If not, running cake schema run update will try to add all the columns for 
 any tables missing model files, so I discovered myself today.

 Regards,

 Ian
 
 IMiJ 
 Ltdhttp://www.imij.co.ukhttp://www.ianmjones.comhttp://twitter.com/ianmjones

 On 25 Mar 2010, at 13:02, Martin Westin wrote:



  I thought I'd give schema migrations a try. But something small must
  be horribly wrong with how I am trying to use the schema shell.

  I run cake schema run update on the database that just generated the
  schema and the shell wants to add all the columns to the tables again.
  That can't be right? What's wrong with my schema that the shell thinks
  all tables are without columns?

  I am on Cake 1.2.6 and Apache2, php5.3, MySQL 5... on a Mac with Snow
  Leopard.

  I tried creating an empty db. I ran a create and it created all
  tables... then I ran update and it again wanted to add all (existing)
  columns to the tables.

  Any ideas?

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
  with their CakePHP related questions.

  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
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php?hl=en

  To unsubscribe from this group, send email to 
  cake-php+unsubscribegooglegroups.com or reply to this email with the words 
  REMOVE ME as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Broken search on http://book.cakephp.org/

2010-03-25 Thread Martin
Have others noticed that the search option on http://book.cakephp.org/
is broken? It no longer returns snippets of text with the search
results, just basic and repeating titles.

Martin

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: CakeFest IV - America - Help us pick a location!

2010-03-25 Thread Martin
USA West Coast, please. :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Class 'AppController' not found.

2010-03-23 Thread Martin Duris
check, if you you have AppController  in C:\xampp\htdocs\cakephp\app\
... maybe you have deleted it ...

2010/3/23 Sean sean...@gmail.com:
 Hey, guys.  I'm a newbie here.  I encountered this problem when trying
 to run a simple controller starting with the following lines:

 class UsersController extends AppController {
        var $name = 'Users';
        var $scarffold;
        var $helpers = array('Html', 'Form', 'Session');
        var $components = array('Auth');
        ...

 And the debugger said Fatal error: Class 'AppController' not found in
 C:\xampp\htdocs\cakephp\app\controllers\users_controller.php on line
 2

 Would you please advise me what kind of mistake could I have made?
 And how can I solve it?
 Thanks a lot.

 - Sean

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

 To unsubscribe from this group, send email to 
 cake-php+unsubscribegooglegroups.com or reply to this email with the words 
 REMOVE ME as the subject.


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Basic ACL question; Why have all users in the ARO?

2010-03-23 Thread Martin Duris
try this : http://book.cakephp.org/view/465/Understanding-How-ACL-Works
sometimes, maybe you will need to create groups for users but in those
groups there will must be some users, who have special - premium acces
...

2010/3/23 xtraorange xtraora...@gmail.com:
 Howdy all,

 Maybe someone can explain this to me, because I'm just having trouble
 understanding:
 In the tutorial (http://book.cakephp.org/view/641/Simple-Acl-
 controlled-Application) the author seems to be suggesting that all
 users should be listed in the ARO table (and their group updated as
 needed).  The thing that I don't understand about this is why?

 Wouldn't it make more sense to just list the users that need special
 permission, and for everyone else just check what their group_id is in
 the user table, and use said for their permission levels?  I doubt
 I'll even have one user that will need a different set of permissions
 other than what the groups will be set to... so is it really necessary
 to list all my users in that table?  What's the advantage there?

 Thanks!
 James

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

 To unsubscribe from this group, send email to 
 cake-php+unsubscribegooglegroups.com or reply to this email with the words 
 REMOVE ME as the subject.


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: different types of Users

2010-03-17 Thread Martin Duris
Using ACL can be very confusing, but it also can be usied to create
simple accesing rules - you have 3 groups (maybe 4 when couting even
visitors - ACL should work fine with that - its just point of view)

but i didnt understand completly your problem - you vae problem with
that, you dont know what newly registered user should be ??? or you
have complet user managment dilema ?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: different types of Users

2010-03-17 Thread Martin Duris
one of the key to understand is to know how ACL works - tree structure
- than its just question of time, to get everything work

2010/3/17 Alejandro Gomez Fernandez agom...@gmail.com:
 I'm new usign cake, but not designing information systems in different
 platforms, even web.
 I think the solution to your dilemma is using ACL. Yes, I know is at the
 beginning difficult to understood and implement, but it was designed
 speciffically to solve this problem. It permits you to assign differents
 roles to any person and to change this persons' role in any moment without
 any aditional work (more than select the roles in the ACL admin).
 Obviously there are many other workarounds to solve your specific problem,
 but the idea behind cake is re-usability. When you adjust an ACL (maybe at
 the beginning almost copy and paste from any book or tutorial) you can
 re-use it in any other project. When many more times you practice to
 develop/implement any technic, more close you are of master it.
 I hope this comment serves you to decide how to approach this problem.

 Regards,



 Alejandro Gomez Fernandez.




 El 16/03/2010 15:44, cricket escribió:

 I'm just starting on a site that will have several types of users and
 am uncertain of the best approach to take. I'd like to hear from
 others who have done something similar.

 The site will have the following user types:

 Administrators
 Members
 Affiliates

 Admins may or not be Members. Affiliates will not be Admins nor
 Members, but the fields for Affiliates and Members are quite similar.
 However, they may diverge further down the road.

 All should be able to log in, so I plan to, at least, have a users
 table with the passwords. But I'd prefer not to have every possible
 field stuffed in there and instead use separate models for each type.
 This seems like a good fit for role-based authentication, using
 Groups, but I think it would make more sense to have separate Member,
 Affiliate, and Administrator models.

 But, in that case, how should I go about registering what a newly-
 logged-in User is? One idea I had was to include model 
 association_key fields in the users table, then loading the info as
 needed (because it will be stored Auth's session array).

 So, how have others approached this? ExtendableBehavior?
 InheritableBehavior? PolymorphicBehavior? Something else?

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: I have an ORM problem

2010-03-12 Thread Martin Duris
dont put echo debug($this-Book-Author-find('all'));  just into
class controller - you need to put in some function (for exampplne
into index fuction)

2010/3/12 Mónico Briseño monico.bris...@gmail.com:
 Hi, all.  Paul, I did your suggestion. I got the following:


 ?php
 class BooksController extends AppController {
 echo debug($this-Book-Author-find('all'));
 }
 ?

 Output


 Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in
 /var/www/relationship/app/controllers/books_controller.php on line 3


 Cheers
 --
 M.S. Mónico Briseño Cortés
 Instructional Technologist  Univ. Houston
 Moodle Teacher Certificate
 NTCM member

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: I have an ORM problem

2010-03-11 Thread Martin Duris
in index.ctp try to write
?php
debug($books);
?

or at least - print_r($books); - so we will know, is in fields - array

2010/3/11 Mónico Briseño monico.bris...@gmail.com:
 Paul, Structure of two tables

 CREATE TABLE `authors` (
     `id` int( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
     `name` varchar( 127 ) NOT NULL ,
     `email` varchar( 127 ) NOT NULL ,
     `website` varchar( 127 ) NOT NULL
     );


 CREATE TABLE `books` (
     `id` int( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
     `isbn` varchar( 13 ) NOT NULL ,
  `title` varchar( 64 ) NOT NULL ,
     `description` text NOT NULL ,
     `author_id` int( 11 ) NOT NULL
     )


 How can I get the output  from echo debug($books)?

 TIA

 --
 M.S. Mónico Briseño Cortés
 Instructional Technologist  Univ. Houston
 Moodle Teacher Certificate
 NTCM member

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: I have an ORM problem

2010-03-10 Thread Martin Duris
yeah, debug yout $book variable is good point (or just use print_r($book))

even that, i still think problem is Author - Name (acording to the
your error log ...)

2010/3/10 WebbedIT p...@webbedit.co.uk:
 Before you move to your view, make sure your controller is sending the
 right data to the view.

 In your controller run your find

 $books = $this-Book-find('all');

 Then debug the results to make sure you are getting your Authors

 echo debug($books);

 If you are not then you need to look at why your find is not pulling
 form the associated model as it should if all settings are default.

 Are the associations setup correctly? Does each book have an author?
 Do you have recursive set to only find from the main model? Are you
 using containable but have not set your containable array?

 HTH

 Paul.

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: cake php XML parser timing out after 30 seconds (not max_execution_time or max_input_time limit)

2010-03-10 Thread Martin Duris
dont know exact answer...but maybe i can help you or point you to some good way
if i understand...you want to parse some xml from web - mean,
download xml and parse it ... so, maybe u should try to avoid using
cakephp defined functions (create some component to download and parse
zml - witch you will manage ...)

but i think, using so much big xml file (assuming from load time) is
not very good for your security (simple dos attack)... i should modify
web to load it from ftp - web directory and i should manualy copy xml
there... (loading of xml in php is not very time consuming - if xml is
very large file, php compil. doesnt take time to check validity just
use pointers - so far i know)

2010/3/10 cartosys plast...@gmail.com:
 code:

        $link = 'http://some.xml.feed.xml';
        $parsed_xml = new XML($link);
        $parsed_xml = Set::reverse($parsed_xml);

 The XML feed at hand is one that took over a minute to load via
 browser.  cakephp's XML returned an empty array after Set::reverse,
 and always after ~30 seconds (timed with a timer).

 I looked into the deeper funcionality and found the trail to the
 problem:

 wWhen new Xml is defined, xml.php calls http-socket.php's load
 function which then calls socket.php's read function:

 The function, which starts on line 217 of socket.php, contains the
 line:

            $buffer = fread($this-connection, $length);

 Which is where the parser time's out after 30 seconds.  This can't be
 fixed by raising any php.ini timout values which I set to 10 minutes.

 max_execution_time = 600
 max_input_time = 600

 So my only solution now is to break the rules and modify cake/lib/
 socket.php  with the following line of code just above the above
 mentioned fread line which works:

 stream_set_timeout ($this-connection, 600);

 The final read function looks like this:
    function read($length = 1024) {
        if (!$this-connected) {
            if (!$this-connect()) {
                return false;
            }
        }
        if (!feof($this-connection)) {
            stream_set_timeout ($this-connection, 600);  //added this
            $buffer = fread($this-connection, $length);
            $info = stream_get_meta_data($this-connection);
            if ($info['timed_out']) {
                $this-setLastError(E_WARNING, __('Connection timed
 out', true));
                return false;
            }
            return $buffer;
        } else {
            return false;
        }
    }

 If anybody knows of a better workaround (like setting
 stream_set_timeout elsewhere in cake or php.ini), that would rock.



 xml parser cakephp ubuntu 9.10

 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: I have an ORM problem

2010-03-09 Thread Martin Duris
 Undefined index:  Author [APP/views/books/index.ctp, line 9]

problem line :
td?php echo $book['Author']['name'] ?/td

i think, problem is in parsed array - you are trying to echo something
that not exist - in array
($book['Author'] dosnt exist or $book['Author']['name'] dosnt exist )

2010/3/9 monicob monico.bris...@gmail.com:
 Hi, all. I have the following problem with ORM:

 I'm learning to use it. I create two tables: books and author, two
 models, two controllers, two HTML files. However, when I run books
 index.ctp

 I got the following error message:

 Undefined index:  Author [APP/views/books/index.ctp, line 9]


 --index.ctp file 

 table
    thead
 thISBN/ththTitle/ththAuthor/th
    /thead
    ?php foreach($books as $book): ?
    tr
    td?php echo $book['Book']['isbn'] ?/td
    td?php echo $book['Book']['title'] ?/td
    td?php echo $book['Author']['name'] ?/td
    /tr
    ?php endforeach; ?
    /table

  I took this cakePHP code from book named: CakePHP Application
 Development edited by Packt publishing.

 Any ideas?

 TIA

 Monico


 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.

 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: After the Cake is baked...

2010-02-22 Thread Martin Westin
Avoid getting sued? Stop being an american work like a charm. ;)
(sorry, I could not resist)


On Feb 22, 8:39 am, Johnny Cupcake sparklew...@hotmail.com wrote:
 OK, so after we have successfully built our modern, interactive
 CakePHP website...where can we learn how to actually /run/ the
 website?  Can you recommend any books or forums that provide a good
 introduction to all the legal, administrative and technical issues?
 For instance, best practices for data backups, how to avoid getting
 sued into oblivion, et cetera.

 The post title is in fun, of course--we all know these issues should
 be dealt with _before_ any coding takes place...right? ;)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: 1.2.6 strtotime error

2010-02-18 Thread Martin Westin
That should not be a Cake 1.2.6 problem but a php 5.3 problem. (or
even possibly 5.2.10 or something)

I had this error notice way before 1.2.6... and the fix is exactly
what you paste... to set the default timezone so that php is happy.
One small problem is that the PHP manual lists a lot of timezones you
can set that PHP doesn't actually support :)

/Martin


On Feb 17, 8:56 pm, Selino seli...@gmail.com wrote:
 :PHP Warning:  strtotime(): It is not safe to rely on the system's
 timezone settings. You are *required* to use the date.timezone setting
 or the date_default_timezone_set() function. In case you used any of
 those methods and you are still getting this warning, you most likely
 misspelled the timezone identifier. We selected 'America/Los_Angeles'
 for '-8.0/no DST' instead in C:\xampp\htdocs\cake_1_2\cake\libs
 \cache.php on line 429:

 I only get this when I try to use bake in a new cakephp 1.2.6 app. If
 I run bake in the default app folder (the one that comes with the cake
 build) it does this. If I run bake from my old 1.2.5 project (cake_1_2/
 myapp) it works fine.

 Is anyone else having this issue with CakePHP 1.2.6 projects?

 It's not a PHP problem because then it would be consistent with any
 time functions I tried.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Complex find() using Oracle

2010-02-18 Thread Martin Radosta
CakePhp is not correctly parsing the alias for the decode fields, thats 
why you see decode... on array keys.
Try using expression for fields. If that works, should also fix the data 
missmatch.


Regards

MARTIN



On 02/18/2010 02:38 PM, TonyFugere wrote:

I've search this group and Google for a solution without any luck.

I can read (SELECT) data, but cannot change this database at all. To
get the data I run the following find:

$this-find('all',
   array(
 'fields' =  array(
   'ServiceData.stat_date',
   'SUBSTR(ServiceData.stat_parameter,1,4) AS
ServiceData.schema',
   'SUBSTR(ServiceData.stat_parameter,19,2) AS
ServiceData.state',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service1\',
ServiceData.stat_value,0)) AS ServiceData.service1',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service2\',
ServiceData.stat_value,0)) AS ServiceData.service2',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service3\',
ServiceData.stat_value,0)) AS ServiceData.service3',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service4\',
ServiceData.stat_value,0)) AS ServiceData.service4',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service5\',
ServiceData.stat_value,0)) AS ServiceData.service5',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service6\',
ServiceData.stat_value,0)) AS ServiceData.service6',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service7\',
ServiceData.stat_value,0)) AS ServiceData.service7',
   'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service8\',
ServiceData.stat_value,0)) AS ServiceData.service8'
 ),
 'conditions' =  array(
   'SUBSTR(ServiceData.stat_parameter, 5, 13)' =
'customer_lookup',
   'SUBSTR(ServiceData.stat_parameter, 1, 4)' =  $active_schema,
   'ServiceData.stat_server LIKE' =  'PRODUCTION%',
   'ServiceData.stat#' =  999,
   'ServiceData.stat_date' =  $load_date,
 ),
 'group' =  array(
   'ServiceData.stat_date',
   'SUBSTR(ServiceData.stat_parameter,1,4)',
   'SUBSTR(ServiceData.stat_parameter,19,2)'
 ),
 'order' =  array('SUBSTR(ServiceData.stat_parameter,19,2)')
   )
);

This is the resulting query:

SELECT
   ServiceData.stat_date
   , SUBSTR(ServiceData.stat_parameter,1,4) AS ServiceData.schema
   , SUBSTR(ServiceData.stat_parameter,19,2) AS ServiceData.state
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service1',
ServiceData.stat_value,0)) AS ServiceData.service1
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service2',
ServiceData.stat_value,0)) AS ServiceData.service2
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service3',
ServiceData.stat_value,0)) AS ServiceData.service3
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service4',
ServiceData.stat_value,0)) AS ServiceData.service4
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service5',
ServiceData.stat_value,0)) AS ServiceData.service5
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service6',
ServiceData.stat_value,0)) AS ServiceData.service6
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service7',
ServiceData.stat_value,0)) AS ServiceData.service7
   , SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service8',
ServiceData.stat_value,0)) AS ServiceData.service8
FROM
   SERVICE_DATA ServiceData
WHERE
   SUBSTR(ServiceData.stat_parameter, 5, 13) = 'customer_lookup'
   AND SUBSTR(ServiceData.stat_parameter, 1, 4) = 'SCHEMA_A'
   AND ServiceData.stat_server LIKE 'PRODUCTION%'
   AND ServiceData.stat_number = 999
   AND ServiceData.stat_date = TO_DATE('2010-02-17 09:00:02', '-MM-
DD HH24:MI:SS')
GROUP BY
   ServiceData.stat_date
   , SUBSTR(ServiceData.stat_parameter,1,4)
   , SUBSTR(ServiceData.stat_parameter,19,2)
ORDER BY
   SUBSTR(ServiceData.stat_parameter,19,2) ASC

This results in data returning in this form:

array(43) {
   [0]=
   array(3) {
 [ServiceData]=
 array(4) {
   [stat_date]=
   string(19) 2010-02-17 09:00:02
   [schema]=
   string(4) SCHEMA_A
   [state]=
   string(2) ()
   [statvalue]=
   string(3) 116
 }
 [SUM(DECODE(SUBSTR(ServiceData]=
 array(1) {
   [stat_parameter,22)]=
   string(3) 107
 }
 [0]=
 array(3) {
   ['service1']=
   string(2) 40
   ['service2']=
   string(3) 116
   ['service3']=
   string(2) 17
 }
   }
}

Notice the odd array keys SUM(DECODE(SUBSTR(ServiceData and
'service1' (this is the decode value in single ticks). Also the
value to service1 is the value that belongs in service2, service2 has
the value for service5, and service3 has the value for service8???

If I remove the SUM(DECODE(SUBSTR( fields, then everything works as
expected:

array(43) {
   [0]=
   array(1) {
 [ServiceData]=
 array(3) {
   [stat_date]=
   string(19) 2010-02-17 09:00:02
   [schema]=
   string(4) SCHEMA_A
   [state]=
   string(2

Re: Complex find() using Oracle

2010-02-18 Thread Martin Radosta

Check the text case in this commit for an example:

http://github.com/cakephp/cakephp1x/commit/02330b2d9c292110240c606e976e182c973897e9

let me know if that fix the problem, if not, you can prepare a test case 
and report the issue.




On 02/18/2010 03:21 PM, TonyFugere wrote:

I don't follow what you mean by Try using expression for fields. Can
you clarify or give me an example?

On Feb 18, 11:12 am, Martin Radostamartinrado...@gmail.com  wrote:
   

CakePhp is not correctly parsing the alias for the decode fields, thats
why you see decode... on array keys.
Try using expression for fields. If that works, should also fix the data
missmatch.

Regards

MARTIN

On 02/18/2010 02:38 PM, TonyFugere wrote:

 

I've search this group and Google for a solution without any luck.
   
 

I can read (SELECT) data, but cannot change this database at all. To
get the data I run the following find:
   
 

$this-find('all',
array(
  'fields' =array(
'ServiceData.stat_date',
'SUBSTR(ServiceData.stat_parameter,1,4) AS
ServiceData.schema',
'SUBSTR(ServiceData.stat_parameter,19,2) AS
ServiceData.state',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service1\',
ServiceData.stat_value,0)) AS ServiceData.service1',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service2\',
ServiceData.stat_value,0)) AS ServiceData.service2',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service3\',
ServiceData.stat_value,0)) AS ServiceData.service3',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service4\',
ServiceData.stat_value,0)) AS ServiceData.service4',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service5\',
ServiceData.stat_value,0)) AS ServiceData.service5',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service6\',
ServiceData.stat_value,0)) AS ServiceData.service6',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service7\',
ServiceData.stat_value,0)) AS ServiceData.service7',
'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service8\',
ServiceData.stat_value,0)) AS ServiceData.service8'
  ),
  'conditions' =array(
'SUBSTR(ServiceData.stat_parameter, 5, 13)' =
'customer_lookup',
'SUBSTR(ServiceData.stat_parameter, 1, 4)' =$active_schema,
'ServiceData.stat_server LIKE' ='PRODUCTION%',
'ServiceData.stat#' =999,
'ServiceData.stat_date' =$load_date,
  ),
  'group' =array(
'ServiceData.stat_date',
'SUBSTR(ServiceData.stat_parameter,1,4)',
'SUBSTR(ServiceData.stat_parameter,19,2)'
  ),
  'order' =array('SUBSTR(ServiceData.stat_parameter,19,2)')
)
);
   
 

This is the resulting query:
   
 

SELECT
ServiceData.stat_date
, SUBSTR(ServiceData.stat_parameter,1,4) AS ServiceData.schema
, SUBSTR(ServiceData.stat_parameter,19,2) AS ServiceData.state
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service1',
ServiceData.stat_value,0)) AS ServiceData.service1
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service2',
ServiceData.stat_value,0)) AS ServiceData.service2
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service3',
ServiceData.stat_value,0)) AS ServiceData.service3
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service4',
ServiceData.stat_value,0)) AS ServiceData.service4
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service5',
ServiceData.stat_value,0)) AS ServiceData.service5
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service6',
ServiceData.stat_value,0)) AS ServiceData.service6
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service7',
ServiceData.stat_value,0)) AS ServiceData.service7
, SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 'service8',
ServiceData.stat_value,0)) AS ServiceData.service8
FROM
SERVICE_DATA ServiceData
WHERE
SUBSTR(ServiceData.stat_parameter, 5, 13) = 'customer_lookup'
AND SUBSTR(ServiceData.stat_parameter, 1, 4) = 'SCHEMA_A'
AND ServiceData.stat_server LIKE 'PRODUCTION%'
AND ServiceData.stat_number = 999
AND ServiceData.stat_date = TO_DATE('2010-02-17 09:00:02', '-MM-
DD HH24:MI:SS')
GROUP BY
ServiceData.stat_date
, SUBSTR(ServiceData.stat_parameter,1,4)
, SUBSTR(ServiceData.stat_parameter,19,2)
ORDER BY
SUBSTR(ServiceData.stat_parameter,19,2) ASC
   
 

This results in data returning in this form:
   
 

array(43) {
[0]=
array(3) {
  [ServiceData]=
  array(4) {
[stat_date]=
string(19) 2010-02-17 09:00:02
[schema]=
string(4) SCHEMA_A
[state]=
string(2) ()
[statvalue]=
string(3) 116
  }
  [SUM(DECODE(SUBSTR(ServiceData]=
  array(1) {
[stat_parameter,22)]=
string(3) 107
  }
  [0]=
  array(3) {
['service1']=
string(2) 40

Re: Complex find() using Oracle

2010-02-18 Thread Martin Radosta

I would only change:

$this-find('all', array('fields' = $fields,...etc, etc.)

Would be great if you post the test case (or even better, a patch) to 
avoid other people waste time with the same issue.


Bye

MARTIN



On 02/18/2010 05:39 PM, Tony Fugere wrote:

It does not fix the problem. Am I doing it correctly?

$dbo = $this-getDataSource();
$expression = 
$dbo-expression('SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), 
\'service1\',

ServiceData.stat_value,0)) AS ServiceData.service1');
$fields = array('ServiceData.stat_date',
 $expression);
$this-find('all', array($fields,...etc, etc.)

Still results in the ugly data.

HOWEVER, I did notice the use of CASE WHEN statements in the test 
case. So, I switched my DECODE to CASE WHEN and it works as expected. 
I will draw up a test case and report the issue of DECODE failing to 
function properly.


Thanks for your help Martin!

-Tony

On Thu, Feb 18, 2010 at 11:40 AM, Martin Radosta 
martinrado...@gmail.com mailto:martinrado...@gmail.com wrote:


Check the text case in this commit for an example:


http://github.com/cakephp/cakephp1x/commit/02330b2d9c292110240c606e976e182c973897e9

let me know if that fix the problem, if not, you can prepare a
test case and report the issue.




On 02/18/2010 03:21 PM, TonyFugere wrote:

I don't follow what you mean by Try using expression for
fields. Can
you clarify or give me an example?

On Feb 18, 11:12 am, Martin Radostamartinrado...@gmail.com
mailto:martinrado...@gmail.com  wrote:

CakePhp is not correctly parsing the alias for the decode
fields, thats
why you see decode... on array keys.
Try using expression for fields. If that works, should
also fix the data
missmatch.

Regards

MARTIN

On 02/18/2010 02:38 PM, TonyFugere wrote:


I've search this group and Google for a solution
without any luck.


I can read (SELECT) data, but cannot change this
database at all. To
get the data I run the following find:


$this-find('all',
   array(
 'fields' =array(
   'ServiceData.stat_date',
   'SUBSTR(ServiceData.stat_parameter,1,4) AS
ServiceData.schema',
   'SUBSTR(ServiceData.stat_parameter,19,2) AS
ServiceData.state',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service1\',
ServiceData.stat_value,0)) AS ServiceData.service1',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service2\',
ServiceData.stat_value,0)) AS ServiceData.service2',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service3\',
ServiceData.stat_value,0)) AS ServiceData.service3',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service4\',
ServiceData.stat_value,0)) AS ServiceData.service4',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service5\',
ServiceData.stat_value,0)) AS ServiceData.service5',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service6\',
ServiceData.stat_value,0)) AS ServiceData.service6',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service7\',
ServiceData.stat_value,0)) AS ServiceData.service7',
 
 'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),

\'service8\',
ServiceData.stat_value,0)) AS ServiceData.service8'
 ),
 'conditions' =array(
   'SUBSTR(ServiceData.stat_parameter, 5, 13)' =
'customer_lookup',
   'SUBSTR(ServiceData.stat_parameter, 1, 4)' =  
 $active_schema,

   'ServiceData.stat_server LIKE' ='PRODUCTION%',
   'ServiceData.stat#' =999,
   'ServiceData.stat_date' =$load_date,
 ),
 'group' =array(
   'ServiceData.stat_date',
   'SUBSTR(ServiceData.stat_parameter,1,4)',
   'SUBSTR(ServiceData.stat_parameter,19,2)'
 ),
 'order' =  
 array('SUBSTR(ServiceData.stat_parameter,19,2)')

   )
);


This is the resulting query

Re: Query to compare items of two users

2010-02-15 Thread Martin Radosta
better than buildStatement for this case I suggest to use expressions. 
This also works with pagination


Hope this helps

MARTIN


On 02/15/2010 02:51 PM, blake wrote:

First, I brief table structure overview:

titles (id, name, etc)
users (id, name, etc)
titles_users (id, title_id, user_id, metadata)

Is there a good way to use TitlesUser-find() to show all the
different titles between user1 and user2?

I've achieved it through a lot of $dbo-buildStatement functions
(building a query, with subquery for showing what user1 has that user2
doesnt...then doing it again for the other direction and doing a
union)but before I go with this, does anyone know of a more cake
friendly way to do it?

If not, whats the best way for me to go back and paginate the results
of the buildStatements / TitlesUser-query()?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: sql expression in CAKE?

2010-02-11 Thread Martin Radosta

Check the test case for this new feature:
http://github.com/cakephp/cakephp1x/commit/02330b2d9c292110240c606e976e182c973897e9#diff-1

Some people says this kind of things breaks the MVC pattern. I should be 
something like

1) get Section lft.
2) add 1 to this
3) save the result in Section rght.

Hope this helps.

MARTIN


On 02/11/2010 06:19 AM, toka...@gmail.com wrote:

Hi, how can I pass a MATH operation into SQL via cake??

I try to do this..but cake always quotes  the '+ 1' as well, and sql
then treat it as a string...


  array('Section.rght' =  'Section.lft + 1')


is there any trick??
Thanks
Tomas

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: About CakePHP and DB2

2010-02-10 Thread Martin Westin

Can you be more specific. Do you have a problem with CakePHPs db2
driver? What specifically is not working?

I haven't used many drivers (MySQL and Sqlite) but I would expect them
all to work just by choosing to use them.
From the manual

var $default = array('driver'  = 'db2',
 'persistent'  = false,
 'host'= 'localhost',
 'login'   = 'cakephpuser',
 'password'= 'c4k3roxx!',
 'database'= 'my_cakephp_project',
 'prefix'  = '');



On Feb 10, 12:18 am, Hector Mansilla Arias hector.mansi...@gmail.com
wrote:
 Hi there!

 I need some information about how to use CakePHP with DB2... Anybody
 has exprience with that?

 I need to use:

 - Debian.
 - Apache.
 - CakePHP.
 - DB2.

 If anybody did a project link this, please help me with a how-to or
 any idea about the implementation...

 Thanks a lot!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: inflector - class methods - slug ????

2010-02-10 Thread Martin Westin
Cake only supports conversion of a specified list of characters to
their root a or o.
You need to patch the Inflector class (and post it back to the
tracker).

line 496 of inflector.php is where the action starts. It is quite
obvious where to add your additional characters. Actually I added
those three to this version if you want the quick fix:

http://bin.cakephp.org/view/1955811171

I will let you post the ticket though.


On Feb 10, 2:02 pm, PaulMan pho...@gmail.com wrote:
 hello,

 echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û
 ç );
 what i want is to have the next result
 a_o_i_oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 but the result is
 _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 ã should be = a
 õ should be = o

 On 10 Fev, 12:41, anler anle...@gmail.com wrote:



  You want to keep the url with your letters as they are? if that is the
  case, google by IDNA (International Domain Names ... or something, or
  the package Net_IDNA in pear.php.net)

  On Feb 10, 1:35 pm, PaulMan pho...@gmail.com wrote:

   echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û ç
   ');

   results:
   _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

   the first three chars do not work, the first and second are used many
   times in Portuguese language...

   is this a bug? does anybody have a solution?

   best regards,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: inflector - class methods - slug ????

2010-02-10 Thread Martin Westin
Just my personal opinion:
Making changes to the core has really not been a problem for me since
I put Cake into a Git repo. I just have a branch with my changes in it
and Git takes care of the merging.




On Feb 10, 11:20 pm, jodator joda...@gmail.com wrote:
 Psst, don't do that ;-) I think I saw a ticket about it and id would
 not be fixed in 1.2 branch, but in 1.3 there should be an option to
 add custom chars mapping.

 Don't hack your core either, because it could cause problems when
 upgrading, doing new stuff from fresh cake, etc. Make your own class,
 or make new function in your app_model/app_controller/app_helper and
 use it $this-mySlug();

 I had the same issue with polish letters and I make copypaste from
 core as one of my models' function.

 On Feb 10, 5:17 pm, PaulMan pho...@gmail.com wrote:



  Thank you both!!!
  I used the patch you gave, and used mb_* functions to set string to
  lowercase ( i was having problems with chars like Ó and Á )

  Martin what do you mean by:
  I will let you post the ticket though.
  Sorry im not a expert on CAKEPHP , yet 

  On 10 Fev, 14:37, Martin Westin martin.westin...@gmail.com wrote:

   Cake only supports conversion of a specified list of characters to
   their root a or o.
   You need to patch the Inflector class (and post it back to the
   tracker).

   line 496 of inflector.php is where the action starts. It is quite
   obvious where to add your additional characters. Actually I added
   those three to this version if you want the quick fix:

  http://bin.cakephp.org/view/1955811171

   I will let you post the ticket though.

   On Feb 10, 2:02 pm, PaulMan pho...@gmail.com wrote:

hello,

echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û
ç );
what i want is to have the next result
a_o_i_oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

but the result is
_õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

ã should be = a
õ should be = o

On 10 Fev, 12:41, anler anle...@gmail.com wrote:

 You want to keep the url with your letters as they are? if that is the
 case, google by IDNA (International Domain Names ... or something, or
 the package Net_IDNA in pear.php.net)

 On Feb 10, 1:35 pm, PaulMan pho...@gmail.com wrote:

  echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô 
  û ç
  ');

  results:
  _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

  the first three chars do not work, the first and second are used 
  many
  times in Portuguese language...

  is this a bug? does anybody have a solution?

  best regards,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Access Global Function in CakePHP

2010-02-10 Thread Martin Westin

I can not imagine why you would use a localized variable variable.
Anyway...

$temp_var = __('String',true);
echo {${$temp_var}};





On Feb 11, 8:14 am, Mukhamad Ikhsan ikhsan.o...@gmail.com wrote:
 global function like __() is break the OOP concept, in some cases i need the
 function bind to an object

 case:
 echo {${$someobject-__('String')}} // This will work
 echo {${__('String')}} // this will not work because curly syntax after ${
 is looking the variable object not a function, even in php manual this
 should work but i have tried and it's not worked

 but because __() is a global function, i don't know how to bind that
 function into a variable/object

 --
 Mukhamad Ikhsan
 Y!id:ikhsan_only

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Mongo without a schema?

2010-02-09 Thread Martin Westin
Hi, I thought I'd see if any user or contributor to the MongoDB
datasource can answer this question.

The datasource is this one by ichikaway:
http://github.com/ichikaway/mongoDB-Datasource

The datasource strangely requires each model to define $_schema in the
class definition. I say strangely since being schema-less is one of
the main benefits of Mongo, Couch et.al.

It would be interesting to get some insight into what make this a
requirement to gauge wether it would be fruitful to try to find a way
past it. I can see that a lot of the Model class referencing $_schema
to for various reasons but I haven't looked into it in depth yet. I
ask before I spend countless hours trying to do something that might
almost end up as a rewrite of Model itself.

thankful for any insight you may have

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Create association with a join table.

2010-02-08 Thread Martin Radosta

Try this:

h1Recipe/h1
div
labelRecipe/label
?php
echo $recipe['Recipe']['recipe'];
$form-create('MenuRecipe', array('url'='/menus/add_recipe'));
echo $form-input('MenuRecipe.recipe_id', array('value'=
$recipe['Recipe']['id'], 'label'=false, 'type'='hidden'));
echo $form-input('MenuRecipe.menu_id');
$form-end('Add to Menu');
?
/div

Regards,

MARTIN


On 02/05/2010 05:33 PM, RhythmicDevil wrote:

Hi,
having some problems understanding how to create an association
between two existing records. The scenario is the following. I have
recipes and menus. When viewing a recipe I want the user to be able to
select a menu from a list to add the recipe to. (Menus contain
Recipes). So once again, the recipe and the list of menus already
exist.

When I submit the data to the Menu-save() method it complains that I
am missing fields. This would make sense if I was creating a new menu
and associating recipes at the same time, but I am not. All that needs
to happen is to insert a new record into menus_recipes (join table)
that has the recipe_id and menu_id. In concept this is simple but
something about model associations is eluding me.

This is the top of the recipe view file where I create a form to send
the menu_id and the recipe_id:

h1Recipe/h1
div
labelRecipe/label
?php
echo $recipe['Recipe']['recipe'];
$form-create('Menu', array('url'='/menus/add_recipe'));
echo $form-input('Recipe.recipe_id', array('value'=
$recipe['Recipe']['id'], 'label'=false, 'type'='hidden'));
echo $form-input('Menu.menu_id');
$form-end('Add to Menu');
?
/div


Here is menus_controller add_recipe:
public function add_recipe()
{
var_dump($this-data);
$this-Menu-saveAll($this-data);
$this-Session-setFlash('The recipe has been added to the 
menu');
$this-redirect(array('controller'='recipes',
'action'='index'));
}


I am probably going to just write a raw SQL statement to take care of
this but I would really like to know the correct Cake methodology for
this. I honestly have read the docs and cant find what I am looking
for, which probably means I am looking for the wrong thing. If you are
really interested here is a link to the source code in Google's
project hosting: http://code.google.com/p/menurecipemanager/

Thanks for any help or advice.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Release: CakePHP 1.2.6

2010-02-01 Thread Martin Westin
I want to add my thanks to everyone contributing.

@Mark
Did you forget to make this topic a sticky? On the first page in the
google group the 1.2.5 announcement is still pinned at the top but
this one is not.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: now Using Session on my model

2010-01-28 Thread Martin Radosta

A callback in the controller avoid a broken the MVC pattern.



On 01/28/2010 02:20 PM, Jamie wrote:

Well, it's certainly better than importing the component...

If you want to be strict about it (and I'm not exactly sure how the
method I suggests falls outside of the MVC pattern, since session info
is just data, just like model data), then just make a model:

class UserSession extends AppModel {
 public $name = 'UserSession';
 public $useTable = false;

 public $session = null;

 function __construct($id = false, $table = null, $ds = null) {
 parent::__construct($id, $table, $ds);
 App::import('Core', 'CakeSession');
 $this-session = new CakeSession();
 }

}

Then you can just use the MySession class in your other models:

ClassRegistry::init('MySession')-session-read('Data');

Obviously not the most elegant solution, but hey, it uses a model. ;)

Totally untested but that wraps the session data inside a model.
On Jan 27, 11:07 pm, the_gurul.rajibah...@gmail.com  wrote:
   

@Jamie,

Its not wrong , its just not best practice and fall out of palce for
MVC design pattern i guess.

On Jan 26, 3:45 am, Jamiejamie@gmail.com  wrote:

 

You don't need to import a component, especially since components are
for controllers. You can just do this in your Cartmodel:
   
 

public $session= null;
   
 

function __construct($id = false, $table = null, $ds = null) {
 parent::__construct($id, $table, $ds);
 App::import('Core', 'CakeSession');
 $this-session= new CakeSession();
   
 

}
   
 

All the SessionComponent does is provide a controller-level wrapper
for the CakeSession class. I don't see anything wrong with importing
CakeSession itself right into yourmodel.
   
 

You can still do all of the regularsessionfunctions:
   
 

$this-session-read
$this-session-delete
$this-session-write
   
 

etc.
   
 

- Jamie
   
 

On Jan 20, 12:40 am, the_gurul.rajibah...@gmail.com  wrote:
   
 

Hello Every body i am now usingSessioncomponent on my Cartmodel
 
 

I have CartModelwhich does not extends from AppModel
 
 

Now here is the code that i am using to accessSessionproperties
 
 

class Cart
{
 public $Session= null;
 
 

 public function __construct(){
 App::import('Component', 'SessionComponent');
 $this-Session= new SessionComponent;
 }
 
 

 public function add($id){
 
 

 }
 
 

 public function remove($id)
 {
 
 

 }
 
 

}
 
 

?
 


 

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
   


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


select with link

2010-01-20 Thread martin
hi,
I need that when is onChange, redirect me to the view page of the
product
(this is on views/layouts/default )

?php echo $form-select('Producto.Id',$this-requestAction('/
productos/findAllProductos'), null, array('onchange'=*,
'class'='select')); ?

how can I do it?

thanks
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


My Cake app presented at CES keynote

2010-01-18 Thread Martin Westin
I have been working on the same Cake app for the past two years. A lot
of it has been a bit hush hush but last week we were truly outed by
Qualcomm.

Check out our 3 min segment from the Keynote:
http://www.greatconnection.se/en/ces

The system transmits medical images from echo machines (ultrasound),
CTs, MRs or any similar digital x-ray type device, to any mobile
phone, any email inbox and a few social networking apps. There is a
lot of high-tech stuff going on behind the scenes and CakePHP is at
the core of it all. Not just for the web-interfaces but actually to
drive the whole thing.

Roughly 85% of the code and all the main logic is CakePHP. The rest is
C and Java for certain things that benefit greatly from being
optimized and run as compiled code.

For a Cake app it is kind of an oddball I imagine. I thought it might
be interesting to hear of a Cake app that is not a CMS or a Twitter
mash-up or some other more common type of application.

I also thought this would come to my defence and help explain some of
the more strange questions I have been asking and problems I have been
having. I may not be all crazy... I hope.


Now... how am I going to work up the courage to attempt to migrate
this monster to 1.3? :)
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: My Cake app presented at CES keynote

2010-01-18 Thread Martin Westin
@John
Thanks.

@Chad
I can't tell what it is exactly

Boy, do I know that phrase! It is so nice to have it out so I don't
have to mask my code and questions as much.
Let me know when you can tell me more. Your app sounds intriguing.

Martin


On Jan 18, 2:07 pm, Chad Smith chadsmith...@gmail.com wrote:
 Hey Martin,

 Nice job!  I too have a rather large app that we are working on with
 cakePHP driving the whole thing.  I can't tell what it is exactly but
 it will be using a C/C# application to do some of the work as the
 program that assists the program is not written in PHP or Java.  Good
 times though, and it's exciting to be working on it.  Sadly it's a
 side project for our company so we haven't had a lot of time to
 dedicate to it yet.  So I might be asking YOU questions about how to
 interface the two systems together sometime soon!  haha.

 Take care and that's really wonderful!  Well done.
 Chad

 On Jan 18, 4:23 am, Martin Westin martin.westin...@gmail.com wrote:



  I have been working on the same Cake app for the past two years. A lot
  of it has been a bit hush hush but last week we were truly outed by
  Qualcomm.

  Check out our 3 min segment from the 
  Keynote:http://www.greatconnection.se/en/ces

  The system transmits medical images from echo machines (ultrasound),
  CTs, MRs or any similar digital x-ray type device, to any mobile
  phone, any email inbox and a few social networking apps. There is a
  lot of high-tech stuff going on behind the scenes and CakePHP is at
  the core of it all. Not just for the web-interfaces but actually to
  drive the whole thing.

  Roughly 85% of the code and all the main logic is CakePHP. The rest is
  C and Java for certain things that benefit greatly from being
  optimized and run as compiled code.

  For a Cake app it is kind of an oddball I imagine. I thought it might
  be interesting to hear of a Cake app that is not a CMS or a Twitter
  mash-up or some other more common type of application.

  I also thought this would come to my defence and help explain some of
  the more strange questions I have been asking and problems I have been
  having. I may not be all crazy... I hope.

  Now... how am I going to work up the courage to attempt to migrate
  this monster to 1.3? :)
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: adding/updating additional fields in HABTM's join table

2010-01-18 Thread Martin Westin

Of-course there is :)

The trick to getting some control over the join table is the with
key.
http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
This tells Cake to use your class file for the join model and any
methods and settings in it.

Mariano also has a good write-up of how to get the join table working
as a real model.
http://marianoiglesias.com.ar/cakephp/modelizing-habtm-join-tables-in-cakephp-1-2-with-and-auto-with-models/

And finally Teknoid has aa very short and clear post about how to
actually save the extra data.
http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/





On Jan 18, 9:36 am, Ernesto e.fanz...@gmail.com wrote:
 Hello.

 as the title says is there any way to add/update additional fields
 in HABTM's join table?
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: coding practices with models

2009-12-29 Thread Martin Westin
I feel the same way sometimes. It is tempting to use model methods as
$record-method() in a way similar to an object-based ORM (e.g. Rails,
where class methods are used for finding and instance methods are used
for record manipulation).

But the way Cake works it is a bit dangerous and I would recommend
following John's advice.

/Martin


On Dec 28, 1:39 pm, John Andersen j.andersen...@gmail.com wrote:
 I use the model class as the maintainer of the individual record and
 the provider of a collection of records.

 So in your banana example, my model would know what to do when a
 controller stated that peeling the banana was required :)

 Whether or not to read the banana into the model depends on the
 situation you are in - is the banana currently being viewed, then the
 model already has the banana - but if the banana was just one of many
 selected by the user for peeling, then the model would need to be
 provided with the id of the banana to peel, read it from the database
 and then peel it :)

 I would not let the controller know whether to read the banana in the
 model, that is the models responsibility, to ensure that the correct
 banana is being peeled :) - so the controller would just provide the
 id to the model through the peel method and the model compares whether
 the current banana is the requested one!

 I usually separate the model methods into those that works with an
 individual record and those that work with a collection of records.

 On Dec 28, 4:14 am, Christian cdamiani...@gmail.com wrote:



  When i come across situations that I feel needs to be coded inside the
  model I'm not sure whether (form the perspective of the controller or
  a different model) to treat a model as an object, or just as a
  collection of class methods.

  For example:

  If I want to peel a banana..

  Is it correct to instantiate the Banana
  $this-Banana-read(null,$id);

  and then call the method
  $this-Banana-peel();

  and in banana.php:
  function peel() {
     //since this method was called on a specific instance
     //it should have access to it's private variables (tuple from the
  database)

  }

  OR do i just call the method on the id and sort that out in the model

  $this-Banana-peel($id);

  then...
  function peel($id) {
     //need to instantiate the banana first before we can operate on it
    $this-Banana-read(null,$id);

  }

  I'm curious about the practices of some of you regular cakers.
  thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: TreeBehavior fails to set lft and rght correctly

2009-12-03 Thread Martin Kirchgessner
On 3 déc, 10:27, AD7six andydawso...@gmail.com wrote:
 How many fails to the tree test case give you.

Well, i've found out what happens. The tree test is OK - my problem
came from an overloaded updateAll in my AppModel.

Sorry for spam.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Containable query

2009-12-03 Thread Martin Westin
Well,
Containable will not do what you want in this case.
Containable will not limit your primary result-set by conditions on
some associated model.

Logically it might be said to flow like this:
Your query will find all Users since you have no condition to limit
the users.
Each User will also contain it's Student if it has one.
Each such related Student will contain it's Submissions if it has any
and student_id is null.

What you want is a join. One that returns only if there is no record
to join to in the submissions table.
You can do joins a bit Cake-like. Pass 'joins' and an array of
parameters to find. It is not well documented in the manual but Nate
wrote a great article for the bakery about it:
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find

You don't have to build anything like what he suggests but at least it
contains some examples of using the joins key.

A quick googling gave me this page detailing some variations of joins
that might help you figure out which type of join you need.
http://www.wellho.net/solutions/mysql-mysql-joins-using-left-join-and-right-join-to-find-orphan-rows.html


/Martin




On Dec 3, 1:53 am, Bryan Paddock bryanpadd...@gmail.com wrote:
 Hmm... nobody have any ideas?

 On Tue, Nov 24, 2009 at 4:05 PM, Bryan Paddock bryanpadd...@gmail.comwrote:



  Hey all,

  I have this relationship in question:

  User - hasOne Student - hasMany Submission

  I'm a bit stumped on how I can fetch all the users who do not have any
  submissions linked to their name.

  I've tried:

          $list = $this-User-find('all', array(
            'contain' = array(
              'Student' = array(
                'Submission' = array(
                  'conditions' = array(
                    'Submission.student_id' = null
                  )
                ),
              )
            )
          ));

  I have the actAs in the model so the containable behaviour is functioning -
  there is just a problem with my specific query.

  Any ideas?

  thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HABTM questions

2009-12-03 Thread Martin Westin
About the pagination:
http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
Look at the bottom. The last examples abut binding can be used to let
paginator deal with your habtm.

When it comes to finding related data find is better than read. But
probably find('first') in this case since it does more or less the
same as read. Use Containable to specify what and how deep you want
your data returned. That should do it...



On Dec 3, 4:02 am, Alan Asher a...@asteriskpound.com wrote:
 I've been scouring the web for a while trying to figure this out.  My brain
 is fried, so I need some help.

 I have a model called Containers, a model called Assets and HABTM table
 called AssetsContainer.

 So a container can have many assets.

 The first question I have is when I'm doing this operation

 $this-Container-read(null,$id);

 How do I paginate the assets.  right now I am only testing so there's only 2
 assets linked to the container.  Am I assuming right that there would be an
 endless number of assets?  If not, still, how do I paginate this data?

 Next question is, each asset can be one of three different tables, Photos,
 Profiles, Blogs.  Each of these models has a hasOne relationship of asset_id
 in each model.  How do I get the read() function to retrieve this data
 automatically?  My first instinct is to put a nominal field for each
 potential table of photo_id, profile_id and blog_id and update the model for
 Asset with the hasOne of each.. This way it will grab the data right?

 Also, is this an instance where instead of read, I use find('all') instead?

 Many thanks,

 Alan

 Example of my Container-read below

 Array
 (
     [Container] = Array
         (
             [id] = 1
             [user_id] = 1
             [title] = Default
             [total_items] =
             [mime_type] = image
             [photo_id] = 1
             [created] = 2009-12-02 11:53:21
             [modified] = 2009-12-02 11:53:21
             [is_fan_club] = 0
             [fan_club_requirements] =
             [nsfw] = 0
             [ordering] =
             [active] =
             [deleted] =
         )

     [User] = Array
         (
             [id] = 1
             [user_type_id] = 2
             [user_group_id] = 3
             [username] = user
             [email] =
             [name] =
             [gender_id] = 1
             [password] =
             [salt] =
             [birthday] = 1991-11-23
             [created] = 2009-11-23 21:41:24
             [modified] = 2009-11-24 15:24:59
         )

     [Photo] = Array
         (
             [id] = 1
             [user_id] = 1
             [asset_id] = 15
             [created] = 1259625133
             [modified] = 1259625133
             [title] =
             [deleted] =
             [file_name] = c0a80aa6-5aab-f111.jpg
             [rel_path] = users/1/2009/11
             [caption] =
             [server_id] = 1
             [is_featured] =
         )

     [Asset] = Array
         (
             [0] = Array
                 (
                     [id] = 1
                     [asset_type_id] =
                     [user_id] =
                     [created] = 2009-11-30 16:12:05
                     [modified] = 2009-11-30 16:12:05
                     [ordering] = 0
                     [allow_comments] = 1
                     [allow_rates] = 1
                     [nsfw] = 0
                     [total_views] = 0
                     [total_rates] = 0
                     [total_rating] = 0
                     [total_comments] = 0
                     [AssetsContainer] = Array
                         (
                             [id] = 1
                             [asset_id] = 1
                             [container_id] = 1
                             [ordering] = 1
                             [created] =
                             [modified] =
                         )

                 )

             [1] = Array
                 (
                     [id] = 2
                     [asset_type_id] =
                     [user_id] =
                     [created] = 2009-11-30 16:13:47
                     [modified] = 2009-11-30 16:13:47
                     [ordering] = 0
                     [allow_comments] = 1
                     [allow_rates] = 1
                     [nsfw] = 0
                     [total_views] = 0
                     [total_rates] = 0
                     [total_rating] = 0
                     [total_comments] = 0
                     [AssetsContainer] = Array
                         (
                             [id] = 2
                             [asset_id] = 2
                             [container_id] = 1
                             [ordering] = 2
                             [created] =
                             [modified] =
                         )

                 )

         )

 )

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related 

Re: download API documentation and book

2009-12-03 Thread Martin Westin
These will not be the great answers you were hoping for. It is just my
DIY way of dealing with the problem you describe.

On the start page of The Book (left sidebar, at the bottom) there is a
link to all in one page. I go there. Get a cup of coffee while it
renders and then save it as a pdf. Then I have a searchable offline
version.

Unfortunately you can't really do the same with the api... but then
again you have the source code. The API is generated from that
directly.
I often open the cake core as a project and search for various
things. I use Textmate which means I also  get a quick index of the
methods in a class just by opening the source file. I imagine other
editors have similar features.


/Martin



On Dec 3, 11:42 am, Lorenzo Bettini bett...@dsi.unifi.it wrote:
 Hi

 is there a version of APIs and book documentation to be downloaded for
 offline browsing?

 thanks in advance
         Lorenzo

 --
 Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
 HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
 BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Delete confirm

2009-12-03 Thread Martin Westin
Really interesting thread guys.

I often resort to just disabling SecurityComponent (I know) when I run
into the black hole of death a few times and can't figure out why.
Is there a good way to debug SecurityComponent problems so that
dealing with specific issues on some forms can be less hit and miss?

For example, I'd like a log or output or something telling me exactly
why my post was denied. Was it because jQuery did the submission?
Because a field doesn't have a corresponding Model? Because...  things
like that.

I don't intend to hijack the thread but since you both (ionas and AD)
seem to have done a fair bit of work on these things I imagine you
have some technique you might be willing to share.

/Martin


On Dec 3, 1:40 pm, AD7six andydawso...@gmail.com wrote:
 On 2 dic, 17:27, j0n4s.h4rtm...@googlemail.com

 j0n4s.h4rtm...@googlemail.com wrote:
  A mostly working solution[1][2], that you can see 
  here:http://github.com/ionas/sna/blob/master/www/app/app_controller.php#L1...

  It is based on Teknoids great information at his blog[3][4], combined
  with a helper that triggers a javascript::confirm(), doubleposts are
  essentially not possible due to SecurityComponent. If you really
  require an js-free confirmation, why not add a checkbox to that helper
  that you have to check before clicking (check if it was clicked in the
  helper and before that onSubmit via javascript)

  [1]http://code.cakephp.org/tickets/view/377
  [2]http://code.cakephp.org/tickets/view/354
  [3]http://teknoid.wordpress.com/2008/11/05/make-your-cakephp-forms-a-lot...
  [4]http://teknoid.wordpress.com/2008/11/06/clearing-up-some-confusion-re...

 That's ... a lot of code. You also have to remember/know in the view
 if you should or should not use your helper.

 FWIW I prefer for things to be a lot more transparent that that.
 Here's an example:http://dl.dropbox.com/u/1027790/csrf-protect-confirm.png

 That's using ajax - but it doesn't have to be (it's not a requirment
 or inherant to the technique/solution).

 The 'magic' is 
 here:http://code.assembla.com/mi/subversion/nodes/branches/mi_plugin/views...

 There's no 'magic' 
 here:http://code.assembla.com/mi/subversion/nodes/branches/blog/views/entr...

 Anyway, good for the topic to be discussed.

 AD

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


TreeBehavior fails to set lft and rght correctly

2009-12-02 Thread Martin Kirchgessner
Hi everyone,

I'm using TreeBehavior in a classic model, but its lft and rght fields
are not set correctly.


I tried these two save() in a controller  :

$this-MenuItem-create();
$this-MenuItem-save(array('MenuItem' = array(
'url' = '/fre',
'parent_id' = null,
'label' = 'Home',
'online' = 1
)));
$parent_id = $this-MenuItem-id;
debug($this-MenuItem-verify());

$this-MenuItem-create();
$this-MenuItem-save(array('MenuItem' = array(
'url' = '/fre/p/Choses',
'parent_id' = $parent_id,
'label' = 'Choses',
'online' = 1
)));

debug($this-MenuItem-verify());

debug($this-MenuItem-recover());

debug($this-MenuItem-verify());

die();

I truncated the table menu_items, ran the test and discovered that the
two last calls to verify() fail, even after recover().

I followed the cookbook... but did I miss something?

If it can helps :
I'm running Cake 1.2.3.8166
I also tried to download the last TreeBehavior from cake's master
branch, but it didn't change anything

thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


  1   2   3   4   5   6   7   >