Sunday, October 4, 2009

Re: cakephp don't execute model trigger plugin's

for eg.
<?php
class SectionsController extends LikecontentAppController {
public $helpers = array ('Html', 'Form', 'Text');
public $uses = array
('Likecontent.LikecontentSection','Likecontent.LikecontentContent');
[...]
function admin_edit($id = null) {
$this->layout = 'admin';
if (! $id && empty ( $this->data )) {
$this->Session->setFlash ( __ ( 'Invalid LikecontentSection',
true ) );
$this->redirect ( array ('action' => 'index' ) );
}
if (!empty ( $this->data )) {
if ($this->LikecontentSection->save ( $this->data )) {
$this->Session->setFlash ( __ ( 'The LikecontentSection has been
saved', true ) );
$this->redirect ( array ('admin' => true, 'action' => 'index' ) );
} else {
$this->Session->setFlash ( __ ( 'The LikecontentSection could not
be sa
[....]
?>

On 3 Paź, 23:26, Bert Van den Brande <cyr...@gmail.com> wrote:
> Can you show some code where the save() is called ?
>
> On Sat, Oct 3, 2009 at 7:55 PM, andrzejborkow...@gmail.com <
>
> andrzejborkow...@gmail.com> wrote:
>
> > save section is ok, but this triger beforeSave don't execute and dont
> > return any value, only working trigers are in >LikecontentAppModel
> > whats going one ?
> > <?php
> > class LikecontentSection extends LikecontentAppModel {
> >        public $validate = array(
> >                'title' => array('notempty'),
> >                'text' => array('notempty')
> >        );
> >        //The Associations below have been created with all possible keys,
> > those that are not needed can be removed
> >        public $hasMany = array('Likecontent.LikecontentContent');
>
> >        public function beforeSave(){
> >                echo 'dupa';
> >                exit;
> >                if(empty($this->data['LikecontentSection']['text']) ||
> > empty($this-
> > >data['LikecontentSection']['url']) || $this->data
> > ['LikecontentSection']['subpage'] == 0){
> >                                $this->data['LikecontentSection']['text'] =
> > '';
> >                                $this->data['LikecontentSection']['url'] =
> > '';
> >                }
> >                return true;
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: