<commit_before><?php

namespace Croogo\Menus\Model\Table;

use Cake\Event\Event;
use Cake\ORM\Entity;
use Croogo\Croogo\Model\Table\CroogoTable;

/**
 * Link
 *
 * @category Model
 * @package  Croogo.Menus.Model
 * @version  1.0
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://www.croogo.org
 */
class LinksTable extends CroogoTable {

/**
 * Validation
 *
 * @var array
 * @access public
 */
	public $validate = array(
		'title' => array(
			'rule' => array('minLength', 1),
			'message' => 'Title cannot be empty.',
		),
		'link' => array(
			'rule' => array('minLength', 1),
			'message' => 'Link cannot be empty.',
		),
	);

	public function initialize(array $config) {
		parent::initialize($config);

		$this->addBehavior('Croogo/Croogo.Encoder');
		$this->addBehavior('Tree');
//		$this->addBehavior('Croogo/Croogo.Cached');
		$this->addBehavior('Croogo/Croogo.Params');
		$this->addBehavior('Croogo/Croogo.Publishable');
//		$this->addBehavior('Croogo/Croogo.Trackable');
		$this->belongsTo('Menus', [
			'className' => 'Croogo/Menus.Menus',
			'counterCache' => true,
		]);
	}


	/**
 * Allow to change Tree scope to a specific menu
 *<commit_msg>Use the encoded type for the visibility_roles field in the links table<commit_after><?php

namespace Croogo\Menus\Model\Table;

use Cake\Database\Schema\Table as Schema;
use Cake\Event\Event;
use Cake\ORM\Entity;
use Croogo\Croogo\Model\Table\CroogoTable;

/**
 * Link
 *
 * @category Model
 * @package  Croogo.Menus.Model
 * @version  1.0
 * @author   <NAME> <<EMAIL>>
 * @license  http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link     http://www.croogo.org
 */
class LinksTable extends CroogoTable {

/**
 * Validation
 *
 * @var array
 * @access public
 */
	public $validate = array(
		'title' => array(
			'rule' => array('minLength', 1),
			'message' => 'Title cannot be empty.',
		),
		'link' => array(
			'rule' => array('minLength', 1),
			'message' => 'Link cannot be empty.',
		),
	);

	public function initialize(array $config) {
		parent::initialize($config);

		$this->addBehavior('Tree');
//		$this->addBehavior('Croogo/Croogo.Cached');
		$this->addBehavior('Croogo/Croogo.Params');
		$this->addBehavior('Croogo/Croogo.Publishable');
//		$this->addBehavior('Croogo/Croogo.Trackable');
		$this->belongsTo('Menus', [
			'className' => 'Croogo/Menus.Menus',
			'counterCache' => true,
		]);
	}

	protected function _initializeSchema(Schema $table) {
		$table->columnType('visibility_roles', 'encoded');

		return parent::_initializeSchema($table);
	}

	/**
 * Allow to change Tree scope to a specific menu
 *
{'fraction_non_alphanumeric': 0.1789709172259508, 'fraction_numerical': 0.002982848620432513, 'mean_word_length': 3.9410681399631677, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1348646', 'n_tokens_mistral': 1003, 'n_tokens_neox': 911, 'n_words': 192}