Tag Archives: mvc

Cakephp 3 Plugin – Changelogs

Ive finally gotten around to releasing this little app i was working on for Cakephp3.  I decided a while ago to abandon Cakephp 2 and go with the new version 3.

Its been a steep learning curve so i wanted to learn as much as i could.  So thats where this app/plugin came in.

The Aim:
The goal of the plugin was to allow a way to simply log tasks, changes or articles about the cakephp project your working on.

If your working on a website/project on your own you need a way to record your changes and tasks so i thought this would be an ideal way to learn and release something. Sure you could do the same with Github and better but i think its better to have something like this integrated into your application.

Screenshot: Version 1
2016-05-25

 

 

 

 

 

Version 2 Screenshot:
changelogseditv2

 

 

 

 


Github & Source:

https://github.com/gerrymcdonnell/cakephp-changelog

Cakephp3-Creating custom queries

23666In your object table;

public function findArtistBy(Query $query, array $options)
{
$artist = $options['search'];

return $query->where(['artist LIKE ' => $artist])
->orwhere(['title LIKE ' => $artist])
->contain(['Mp3files'])
->order(['title' => 'DESC']);
}

In your controller method;

$options['search']=$search;
$query=$this->Mp3filesTags->find('ArtistBy',$options);

$this->Flash->success(__('Search complete'));

$this->set('results', $query);
$this->set('count',$count);

So what does it do?
It will return the results where the artist field is like eg.”U2″ and where the title is like “U2”.
It also has an order clause in there and will contain the related records set “mp3files”.

Reference:
http://book.cakephp.org/3.0/en/orm/query-builder.html