10 defined(
'JPATH_PLATFORM') or die;
63 parent::__construct(
'#__assets',
'id', $db);
75 public function loadByName($name)
77 $query = $this->_db->getQuery(
true)
78 ->select($this->_db->quoteName(
'id'))
79 ->from($this->_db->quoteName(
'#__assets'))
80 ->where($this->_db->quoteName(
'name') .
' = ' . $this->_db->quote($name));
81 $this->_db->setQuery($query);
82 $assetId = (int) $this->_db->loadResult();
89 return $this->load($assetId);
100 public function check()
102 $this->parent_id = (int) $this->parent_id;
105 if ($this->parent_id > 0)
108 $query = $this->_db->getQuery(
true)
109 ->select(
'COUNT(id)')
110 ->from($this->_db->quoteName($this->_tbl))
111 ->where($this->_db->quoteName(
'id') .
' = ' . $this->parent_id);
112 $this->_db->setQuery($query);
114 if ($this->_db->loadResult())
120 $this->setError(
'Invalid Parent ID');