Wednesday, September 30, 2015

Query showing all data

Hi,
I am fetching a strange problem.
When i am using a custom query like the following one
 $re = $this->Expressinterest->query( "SELECT * FROM expressinterest Where eireceiver = '$matriid' order by id desc limit 0 , 5");
     
It's taking all the data though here is a condition and limit.
Can anyone tell me what's the problem.

Thanks
Zahid

--
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+unsubscribe@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.

Re: Classifieds aggregator

Your request is too vague. Start building and then ask when you are stuck

On Wed, Sep 23, 2015 at 12:29 AM, Brara morad35 <bramorad35@gmail.com> wrote:
Hello,
I'm on a project to build an  portal web of   Classifieds aggregator that will contain two types of ads:
- local ads: added by our users
- Aspirated ads other sites of adds

This is the 1st time that I attack a web project of this magnitude, I would like to know what path to take
For information I have adopted the method of Pascal Roques for my project, but to start development I paddled a bit.

--
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+unsubscribe@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.



--
=============================================================
Hire a CakePHP dev team : http://sanisoft.com
=============================================================

--
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+unsubscribe@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.

Re: Encyption/Decryption of Form Fields in CakePHP 3

You can try to use my CipherBehavior plugin.

https://github.com/adayth/cakephp-cipher-behavior

El domingo, 23 de agosto de 2015, 22:13:34 (UTC+1), Alexander Slotty escribió:
Hello,

I was hoping someone could help with my task. It should be "relatively" simple: I want to have some form-fields encrypted when they are added/edited and decrypted when they are looked up by cake.
Here is the code that works for me in v2.7.2:

core.php:
Configure::write('Security.key','secretkey');

app/Model/Patient.php:
public $encryptedFields = array('patient_surname', 'patient_first_name');

public function beforeSave($options = array()) {
    foreach($this->encryptedFields as $fieldName){
        if(!empty($this->data[$this->alias][$fieldName])){
            $this->data[$this->alias][$fieldName] = Security::encrypt(
                $this->data[$this->alias][$fieldName],
                Configure::read('Security.key')
            );
        }
    }
    return true;
}

public function afterFind($results, $primary = false) {

    foreach ($results as $key => $val) {
        foreach($this->encryptedFields as $fieldName) {
            if (@is_array($results[$key][$this->alias])) {
                $results[$key][$this->alias][$fieldName] = Security::decrypt(
                    $results[$key][$this->alias][$fieldName],
                    Configure::read('Security.key')
                );
            }
        }
    }
    return $results;
}

As I understand it I have to replace $this->data[] with the generated entities for the model and the afterFind method with virtual fields, but I just can't put it all together.

Thanks for any pointers

--
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+unsubscribe@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.

Tuesday, September 29, 2015

Re: Domain Layer of the Domain Drive Design and CakePHP

You can use any other folder name in Cake2 as well, just used App::uses() instead of the namespaces. But if your php version supports namespaces you can use them in Cake2 as well. Just tell the PSR autoloader where they are.

On Monday, September 28, 2015 at 6:30:19 PM UTC+2, gersonfs wrote:
Thank's Florian, it seems to make sense. As I am still not using cake3, I thought of using "libs" because the App class allows loading of these.

Em sábado, 26 de setembro de 2015 10:25:05 UTC-3, Florian Krämer escreveu:
Read the first two answers here:


I wouldn't call it lib, if you go for Cake3 just create a new namespace "App\Domain" and put your classes into that folder, maybe following a convention like other things as well. For example "ReservationsDomain.php".

Check the ModelAwareTrait you could create a DomainAware trait that instantiates the Domains in your controllers as needed and automatically passes the request object to your domain objects.

On Friday, September 25, 2015 at 2:36:18 PM UTC+2, gersonfs wrote:
Hello,

Where the domain layer would fit better in a CakePHP APP? Models I believe it would not. It would be a generic PHP Class into a "Lib"?

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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@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.

Monday, September 28, 2015

CakePHP 2.7.4 Released

The CakePHP core team is happy to announce the immediate availability of CakePHP 2.7.4. This is a maintenance release for the 2.7 branch that fixes several reported issues.

Bugfixes
--------

You can expect the following changes in 2.7.4. See the [changelog]
(http://cakephp.org/changelogs/2.7.4) for every commit.

* When saving, models will always correctly set the 'updated' and 'created' fields. Even when a 'fieldList' is used, and those fields are not in the fieldList.
* SessionHelper and FlashHelper are now more compatible with messages set through either the SessionComponent or FlashComponent.
* Bake generates fixtures with only 1 record by default now.
* The default value of CURRENT_TIMESTAMP is now supported for MySQL datetime columns.
* Datasources no longer fatally error if isConnected() is called after disconnect().
* Improved API documentation.
* Email configuration defaults are now correctly loaded even when the configuration class has not been loaded.
* Virus is now pluralized to viruses.

As always, a huge thanks to all the community members that helped make this release happen by reporting issues and sending pull requests.

Download a [packaged release on github](https://github.com/cakephp/cakephp/releases).

--
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+unsubscribe@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.

Re: Domain Layer of the Domain Drive Design and CakePHP

Thank's Florian, it seems to make sense. As I am still not using cake3, I thought of using "libs" because the App class allows loading of these.

Em sábado, 26 de setembro de 2015 10:25:05 UTC-3, Florian Krämer escreveu:
Read the first two answers here:


I wouldn't call it lib, if you go for Cake3 just create a new namespace "App\Domain" and put your classes into that folder, maybe following a convention like other things as well. For example "ReservationsDomain.php".

Check the ModelAwareTrait you could create a DomainAware trait that instantiates the Domains in your controllers as needed and automatically passes the request object to your domain objects.

On Friday, September 25, 2015 at 2:36:18 PM UTC+2, gersonfs wrote:
Hello,

Where the domain layer would fit better in a CakePHP APP? Models I believe it would not. It would be a generic PHP Class into a "Lib"?

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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@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.

$hasAndBelongsToMany Problems

Good Day

I am still very very new to CakePHP and I have gained tons of respect for it, but I having a problem with $hasAndBelongsToMany .

The issue I am having is the  echo $this->Form->input('TypesGames'); Displays nothing but an input empty Box,





but if I do an print_r on the $TypesGames the array displays all my TypesGame I get an return eg: 

	Array  (      [1] => soccer      [2] => tennis      [3] => cricket  )

Please can someone help

Many Thanks
Daniel

Here is my code:

model/game.php

public $hasAndBelongsToMany = array(
'TypesGame' => array(
'className' => 'TypesGame',
'joinTable' => 'linked_gametypes',
'foreignKey' => 'types_games_id',
'associationForeignKey' => 'games_id',
'unique' => 'keepExisting',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
)
);

Controller/GamesController.php

public function add() {
if ($this->request->is('post')) {
$this->Game->create();
if ($this->Game->save($this->request->data)) {
$this->Session->setFlash(__('The game has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The game could not be saved. Please, try again.'));
}
}
$TypesGames = $this->Game->TypesGame->find('list');
$venues = $this->Game->Venue->find('list');
$cities = $this->Game->Cities->find('list');
$this->set(compact('venues', 'cities','TypesGames'));
}

 View/Games/add.ctp

<?php echo $this->Form->create('Game'); ?>
<fieldset>
<legend><?php echo __('Add Game'); ?></legend>
<?php
echo $this->Form->input('venue_id');
echo $this->Form->input('GameName');
echo $this->Form->input('info');
echo $this->Form->input('price');
echo $this->Form->input('TypesGames');
echo $this->Form->input('dateStart');
echo $this->Form->input('dateEnd');
echo $this->Form->input('timeStart');
echo $this->Form->input('timeEnd');
echo $this->Form->input('cities_id');
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>




--
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+unsubscribe@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.

Saturday, September 26, 2015

Re: Domain Layer of the Domain Drive Design and CakePHP

Read the first two answers here:

http://programmers.stackexchange.com/questions/140999/application-layer-vs-domain-layer

I wouldn't call it lib, if you go for Cake3 just create a new namespace "App\Domain" and put your classes into that folder, maybe following a convention like other things as well. For example "ReservationsDomain.php".

Check the ModelAwareTrait you could create a DomainAware trait that instantiates the Domains in your controllers as needed and automatically passes the request object to your domain objects.

On Friday, September 25, 2015 at 2:36:18 PM UTC+2, gersonfs wrote:
Hello,

Where the domain layer would fit better in a CakePHP APP? Models I believe it would not. It would be a generic PHP Class into a "Lib"?

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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@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.

Friday, September 25, 2015

Re: CakePHP 3.1: Login with Username or Email?

Goodle it:
http://stackoverflow.com/questions/30648852/login-with-username-or-email-with-cakephp-3

On Friday, 25 September 2015 22:07:19 UTC+3, Salines wrote:
Can any of the core CakePHP developers explain to us in what manner we can perform user authentication with username or email plus password.

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+unsubscribe@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 3.1: Login with Username or Email?

Can any of the core CakePHP developers explain to us in what manner we can perform user authentication with username or email plus password.

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+unsubscribe@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.

Unable to change default theme of cakephp 3.x to twitter like theme using Bake

hi,
how can i change my default cake php 3.x theme to some nice looking theme like twitter look theme that bootstrap provided..
downloaded some theme and plugins using composer  form terminal..
but very confused about where to put plugin folder and how to Bake code using : /bin/cake bake all
so that plugin or theme changes automatically apply all my view files that created from Bake..
suggest me the proper folder structure and how to bake that plugins

--
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+unsubscribe@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.

Domain Layer of the Domain Drive Design and CakePHP

Hello,

Where the domain layer would fit better in a CakePHP APP? Models I believe it would not. It would be a generic PHP Class into a "Lib"?

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 unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@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.

Re: New CakePHP ORM to CakePHP 2.x

Hello Sulian and José,

I have this problem too. Only much bigger. Because of that I have not yet adopted the CakePHP 3.

Migrating an application with 300 tables and business rules from CakePHP 2 to 3, it takes a long time, this transition should be possible to be made into parts.

I can not stop production completely to migrate becouse during this period of time the customer comes with new needs. A git merge does not apply in this case because the ORM is very different.

Any suggestion?

Em terça-feira, 22 de setembro de 2015 04:23:50 UTC-3, Sulian Lanteri escreveu:
Hello

Before migrate a big application in CakePHP3, I want first use the new ORM in this CakePHP 2.6 application, any idea how to do that (and/or a good example) ?

Sulian

--
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+unsubscribe@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 3 validation

Hello,

How can i set validation without page refresh in cakephp 3

--
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+unsubscribe@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.

cackphp 3 globe function define for Model(table)

Hello,

I have one question 

in cakephp 3 i have class of demo

---------------------------------------------------------------------------
class DemosTable extends Table {

}
---------------------------------------------------------------------------
like that so i want to create one function as globally for all Table class so how can i define it


--
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+unsubscribe@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.

Thursday, September 24, 2015

Re: New CakePHP ORM to CakePHP 2.x

Hello José

I want to replace the 2.x orm system by the new ORM before upgrading to CakePHP3. My app have several modules, at last about 100 tables. I prefer migrate the ORM in CakePHP2 rather than migrating everything at once.

Le mardi 22 septembre 2015 10:57:01 UTC+2, José Lorenzo a écrit :
It depends. The ORM can be installed as a standalone library already, what kind of integration are you looking after?

On Tuesday, September 22, 2015 at 9:23:50 AM UTC+2, Sulian Lanteri wrote:
Hello

Before migrate a big application in CakePHP3, I want first use the new ORM in this CakePHP 2.6 application, any idea how to do that (and/or a good example) ?

Sulian

--
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+unsubscribe@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.

Wednesday, September 23, 2015

Re: SQL autojoin to ORM Cake3


SOLVED

In belongsTo table I add:
        $this->hasMany('TopLogs', [
           
'className' => 'Logs',
           
'strategy' => 'select',
           
'conditions' => function ($exp, $query) {
                $query
->leftJoin(
                   
['TmpLogs' => 'logs'],
                   
[
                       
'TopLogs.group_id = TmpLogs.group_id',
                       
'TopLogs.id < TmpLogs.id'
                   
]);
               
return $exp->add(['TmpLogs.id IS NULL']);
           
}
       
]);




On Wednesday, September 23, 2015 at 10:42:05 AM UTC-3, uru...@gmail.com wrote:
Hi, I have this SQL a need to transform to ORM. I I appreciate any approach


LOGS
id - group_id - data
1        1      'Lorem ipsum 1'
2        1      'Lorem ipsum 2'
3        2      'Lorem ipsum 3'


SQL return the latest record in your group:
id - group_id - data
2        1      'Lorem ipsum 2'
3        2      'Lorem ipsum 3'

SELECT logs.id,logs.group_id,logs.data
FROM logs
LEFT JOIN logs AS latest
ON
(logs.group_id = latest.group_id AND logs.id < latest.id)
WHERE latest
.id IS NULL
ORDER BY logs
.id DESC


--
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+unsubscribe@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.

Montando um Array json_encode()

Galera, preciso de uma ajuda pra montar um array do mau aqui. Peguei um calendário(bootstrap calendar) pronto e estou tentando implementar ele no meu site com Cakephp. Tudo certo com o layout mas na hora de buscar as informações no banco ele espera receber um Array da seguinte forma:

{"success":1,"result":[{"0":"1","id":"1","1":"Teste","title":"Teste","2":"Apenas para Teste","body":"Apenas para Teste","3":".\/descripcion_evento.php?id=1","url":".\/descripcion_evento.php?id=1","4":"event-important","class":"event-important","5":"1443105000000","start":"1443105000000","6":"1443112800000","end":"1443112800000"}]}

No calendar original ele monta da seguinte forma:

if ($conexion->query($sql)->num_rows) {         $datos = array();           $i=0;        $e = $conexion->query($sql);         while($row=$e->fetch_array())      {          $datos[$i] = $row;          $i++;      }        echo json_encode(                             array(                                    "success" => 1,                       "result" => $datos                )                                );    }
Mas não tem cristo que eu consiga fazer isso pelo cakephp. o melhor resultado que tive foi esse:
{"success":1,"result":[{"Agenda":{"id":"1","title":"teste","body":"teste","url":"teste","class":"event-important","start":"1443105000000","end":"1443112800000","0":"1","1":"teste","2":"teste","3":"teste","4":"event-important","5":"1443105000000","6":"1443112800000"}}]}
Meu controller ficou assim:

public function obter_eventos(){      $datos = $this->Agenda->find('all');        foreach ($datos as $key => $dato) {          foreach ($dato as $value) {              $i = 0;              foreach ($value as $valor) {                  $datos[$key]['Agenda'][$i] = $valor;                  $i++;              }          }      }        echo json_encode(                        array(                                "success" => 1,                   "result" => $datos            )                             );        $this->autoRender=false;        }

--
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+unsubscribe@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.

Re: Não estou conseguindo usar o plugin CakePtbr para pluralização

Check the name of the plugin everywhere!!

CakePrbr or CakePtbr or ???

Enjoy, John

On Wednesday, 23 September 2015 14:06:20 UTC+3, Andre Luis Sa wrote:
Estou usando o cakephp 3.0 e venho tentando utilizar o plugin CakePtbr para corrigir a pluralização e fazer a tradução.

Segui a instrução da documentação do plugin disponivel no github:
1.      Adicionar  a seguinte linha no /config/bootstrap.php Plugin::load("CakePtbr");
2.    Para traduzir as mensagens do core, copie ou faça um link simbólico do arquivo src/Locale/pt_BR/cake.po para sua pasta src/Locale/pt_BR.

Mas a pluralização não esta correta, palavras com o plural terminados em "-oes" tem o sigular gerado com o final "-o" sendo que deveriam ser "-ao". 

Acreditando que o plugin não estava sendo carregado, cheguei nessas configurações:

O erro persistiu... Então troquei o trecho do bootstrap.php
Plugin::load("CakePrbr");
por
Plugin::load(array('CakePtbr'=>array('bootstrap'=>true)));

E agora quando tento fazer bin/cake bake model all surge o seguinte erro:
PHP Fatal error:  Class 'Plugin' not found in ~/plugins/CakePtbr/config/bootstrap.php on line 14

Como solução temporária para corrigir a pluralização estou criando a regra no Inflector, mas também queria utilizar as outras funcionalidades do plugin, então alguém me ajudar?


--
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+unsubscribe@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.

SQL autojoin to ORM Cake3

Hi, I have this SQL a need to transform to ORM. I I appreciate any approach


LOGS
id - group_id - data
1        1      'Lorem ipsum 1'
2        1      'Lorem ipsum 2'
3        2      'Lorem ipsum 3'


SQL return the latest record in your group:
id - group_id - data
2        1      'Lorem ipsum 2'
3        2      'Lorem ipsum 3'

SELECT logs.id,logs.group_id,logs.data
FROM logs
LEFT JOIN logs AS latest
ON
(logs.group_id = latest.group_id AND logs.id < latest.id)
WHERE latest
.id IS NULL
ORDER BY logs
.id DESC


--
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+unsubscribe@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.

Tuesday, September 22, 2015

Re: Encyption/Decryption of Form Fields in CakePHP 3

The answer on that stackoverflow page is for CakePHP 3. Why would you be writing your new app in version 2.x? 

To answer your question, if you are getting a Resource back then you will need to read the contents of that Resource using stream_get_contents()

On Tuesday, 22 September 2015 09:23:50 UTC+2, Paweł B wrote:
Did you solve this problem? It tried http://stackoverflow.com/questions/32260229/encyption-decryption-of-form-fields-in-cakephp-3 but still no luck (return Resource Id #???). New app will be in ver 2.x or in other framework...

W dniu niedziela, 23 sierpnia 2015 23:13:34 UTC+2 użytkownik Alexander Slotty napisał:
Hello,

I was hoping someone could help with my task. It should be "relatively" simple: I want to have some form-fields encrypted when they are added/edited and decrypted when they are looked up by cake.
Here is the code that works for me in v2.7.2:

core.php:
Configure::write('Security.key','secretkey');

app/Model/Patient.php:
public $encryptedFields = array('patient_surname', 'patient_first_name');

public function beforeSave($options = array()) {
    foreach($this->encryptedFields as $fieldName){
        if(!empty($this->data[$this->alias][$fieldName])){
            $this->data[$this->alias][$fieldName] = Security::encrypt(
                $this->data[$this->alias][$fieldName],
                Configure::read('Security.key')
            );
        }
    }
    return true;
}

public function afterFind($results, $primary = false) {

    foreach ($results as $key => $val) {
        foreach($this->encryptedFields as $fieldName) {
            if (@is_array($results[$key][$this->alias])) {
                $results[$key][$this->alias][$fieldName] = Security::decrypt(
                    $results[$key][$this->alias][$fieldName],
                    Configure::read('Security.key')
                );
            }
        }
    }
    return $results;
}

As I understand it I have to replace $this->data[] with the generated entities for the model and the afterFind method with virtual fields, but I just can't put it all together.

Thanks for any pointers

--
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+unsubscribe@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.

Re: Encyption/Decryption of Form Fields in CakePHP 3

In CakePHP 3, I would make use of a custom data type. See http://book.cakephp.org/3.0/en/orm/database-basics.html#adding-custom-types for more information and an example.

On Sunday, 23 August 2015 23:13:34 UTC+2, Alexander Slotty wrote:
Hello,

I was hoping someone could help with my task. It should be "relatively" simple: I want to have some form-fields encrypted when they are added/edited and decrypted when they are looked up by cake.
Here is the code that works for me in v2.7.2:

core.php:
Configure::write('Security.key','secretkey');

app/Model/Patient.php:
public $encryptedFields = array('patient_surname', 'patient_first_name');

public function beforeSave($options = array()) {
    foreach($this->encryptedFields as $fieldName){
        if(!empty($this->data[$this->alias][$fieldName])){
            $this->data[$this->alias][$fieldName] = Security::encrypt(
                $this->data[$this->alias][$fieldName],
                Configure::read('Security.key')
            );
        }
    }
    return true;
}

public function afterFind($results, $primary = false) {

    foreach ($results as $key => $val) {
        foreach($this->encryptedFields as $fieldName) {
            if (@is_array($results[$key][$this->alias])) {
                $results[$key][$this->alias][$fieldName] = Security::decrypt(
                    $results[$key][$this->alias][$fieldName],
                    Configure::read('Security.key')
                );
            }
        }
    }
    return $results;
}

As I understand it I have to replace $this->data[] with the generated entities for the model and the afterFind method with virtual fields, but I just can't put it all together.

Thanks for any pointers

--
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+unsubscribe@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.