Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] fork on model

fork on model 20 Mar 2014 15:15 #12317

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
Hi i did a component

on the model i have models/experiment_type.php
class RmnmanagementCkModelExperimenttype extends RmnmanagementClassModelList
{
.....
code
....
protected function prepareQuery(&$query)
{
... code ...
}

...
}

I want to make some changes, thus i go to _fork/models/experiment_type.php
class RmnmanagementModelExperimenttype extends RmnmanagementCkModelExperimenttype
{

/**
* Preparation of the list query.
*
* @access protected
* @param object &$query returns a filled query object.
* @return void
*/
protected function prepareQuery(&$query)
{
echo 'a';die;
}
}

and it does nothing !!
why??
The administrator has disabled public write access.

fork on model 21 Mar 2014 19:42 #12332

  • dyoungers
  • dyoungers's Avatar
  • Offline
  • Premium Member
  • Posts: 123
  • Thank you received: 16
  • Karma: 0
Did you copy the model from the _fork directory to the fork directory?
The administrator has disabled public write access.

fork on model 21 Mar 2014 19:43 #12333

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
i just copied the function

protected function prepareQuery(&$query)
{
echo 'a';die;
}
The administrator has disabled public write access.

fork on model 21 Mar 2014 23:02 #12338

  • dyoungers
  • dyoungers's Avatar
  • Offline
  • Premium Member
  • Posts: 123
  • Thank you received: 16
  • Karma: 0
Sorry, I wasn't very clear

The file experiment_type.php needs to be in the directory fork/models, i.e. copy it from _fork

_fork contains the base files for forking but that directory is not used at runtime, the fork directory is where the code looks for overrides

Dave
The administrator has disabled public write access.

fork on model 22 Mar 2014 09:20 #12342

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Documentation for the forks :
www.j-cook.pro/index.php/f/forks

Also, you must respect the fork location (front or back)
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.058 seconds

Get Started