/** * Return true if specified property exists * * @param string $name Property name * * @return boolean */ public function isPropertyExists($name) { return property_exists($this, $name) || property_exists($this, \XLite\Core\Converter::convertFromCamelCase($name)); }
/** * Build edit url * * @param \XLite\Model\AEntity $entity Entity * * @return string */ public function buildEditURL($entity) { $result = ''; $entityType = static::getEntityType($entity); $method = $entityType ? __FUNCTION__ . \XLite\Core\Converter::convertToCamelCase($entityType) : null; $data = method_exists($this, $method) ? $this->{$method}($entity) : array(\XLite\Core\Converter::convertFromCamelCase($entityType), array($entity->getUniqueIdentifierName() => $entity->getUniqueIdentifier())); if ($data) { list($target, $params) = $data; if ($target) { $result = \XLite\Core\Converter::buildURL($target, '', $params); } } return $result; }
/** * Emulate the Doctrine autogenerated methods. * TODO - DEVCODE - to remove! * * @param string $method Method name * @param array $args Call arguments OPTIONAL * * @return mixed * @throws \BadMethodCallException */ public function __call($method, array $args = array()) { $result = preg_match('/^(get|set)(\\w+)$/Si', $method, $matches) && !empty($matches[2]); if ($result) { $property = \XLite\Core\Converter::convertFromCamelCase($matches[2]); $result = property_exists($this, $property); } $return = null; if ($result) { if ('set' === $matches[1]) { $this->{$property} = array_shift($args); } else { $return = $this->{$property}; } } else { throw new \BadMethodCallException(get_class($this) . '::' . $method . '() - method not exists or invalid getter/setter'); } return $return; }
/** * Emulate the Doctrine autogenerated methods. * TODO - DEVCODE - to remove! * * @param string $method Method name * @param array $args Call arguments OPTIONAL * * @return mixed */ public function __call($method, array $args = array()) { $result = preg_match('/^(get|set)(\\w+)$/Si', $method, $matches) && !empty($matches[2]); if ($result) { $property = \XLite\Core\Converter::convertFromCamelCase($matches[2]); $result = 'set' === $matches[1] ? $this->setterProperty($property, array_shift($args)) : $this->getterProperty($property); } else { $result = null; } return $result; }