Example #1
0
	/**
	 * Freezes an array
	 *
	 * @return void
	 */
	public function freeze()
	{
		if (!$this->isFrozen()) {
			$this->onFreeze($this);
			parent::freeze();
		}
	}
Example #2
0
 /**
  * Locks this object for further changes
  *
  * @return void
  */
 public function freeze()
 {
     parent::freeze();
     if ($this->_og) {
         $this->_og->freeze();
     }
 }
Example #3
0
 /**
  * Is property defined?
  *
  * @param  string  property name
  *
  * @return bool
  */
 public function __isset($key)
 {
     return isset($this->data[$key]) || parent::__isset($key);
 }
Example #4
0
parent::__get($key);}else{return$this->data[$key];}}function
__isset($key){return
isset($this->data[$key])||parent::__isset($key);}function
Example #5
0
 /**
  * Static Magic find.
  * - $col = Page::findByUrl('about-us');
  * - $rec = Page::findByCategoryIdAndVisibility(5, TRUE);
  * - $rec = User::findByNameAndLogin('John', 'john007');
  * - $rec = Product::findByCategory(3);
  *
  * @param string $name
  * @param array  $args
  * @return ActiveCollection|ActiveRecord|NULL
  */
 public static function __callStatic($name, $args)
 {
     if (strncmp($name, 'findBy', 6) === 0) {
         // single record
         //$method = 'find';
         $name = substr($name, 6);
     } else {
         return parent::__callStatic($name, $args);
     }
     // ProductIdAndTitle -> array('productId', 'title')
     $parts = array_map('lcfirst', explode('And', $name));
     if (count($parts) !== count($args)) {
         throw new \Nette\InvalidArgumentException("Magic find expects " . count($parts) . " parameters, but " . count($args) . " was given.");
     }
     return self::findBy(array_combine($parts, $args));
 }