EAV attribtutes
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: EAV attribtutes
Ahhhhh ... you mean it spelled driver but it's pronounced 'Throatwobbler Mangrove' ... and yes, it's spelled adapter but it's pronounced 'Luxury Yacht' ... 
(#10850)
Re: EAV attribtutes
I don't use the methods you've described, and not only is there no performance hit, when used in a simple hash table stored in memory, blows RDBMS away. I simply use MySQL for convenience, and even then it's faster than traditional table structure.arborint wrote: Or you could use it like powerofq has where it becomes the entire system. He seems to like standardizing/simplifying the development side and does not mind the performance hit in his applications.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: EAV attribtutes
Well ... we now know you use a cache to get around the performance issues. Not that I could understand it...powerofq wrote:I don't use the methods you've described, and not only is there no performance hit, when used in a simple hash table stored in memory, blows RDBMS away. I simply use MySQL for convenience, and even then it's faster than traditional table structure.
(#10850)
Re: EAV attribtutes
I think Doctrine_Migration does everything I had in mind
http://www.doctrine-project.org/documen ... =migration
and the icing on the cake
http://www.doctrine-project.org/documen ... hical-data
Edit: Arboint is right, it only does nested sets, my mistake.. this thread is dead.
Code: Select all
public function createTable($tableName, array $fields = array(), array $options = array())
public function dropTable($tableName)
public function renameTable($oldTableName, $newTableName)
public function createConstraint($tableName, $constraintName, array $definition)
public function dropConstraint($tableName, $constraintName, $primary = false)
public function createForeignKey($tableName, array $definition)
public function dropForeignKey($tableName, $fkName)
public function addColumn($tableName, $columnName, $type, array $options = array())
public function renameColumn($tableName, $oldColumnName, $newColumnName)
public function changeColumn($tableName, $columnName, $type, array $options = array())
public function removeColumn($tableName, $columnName)
public function addIndex($tableName, $indexName, array $options = array())
public function removeIndex($tableName, $indexName)
and the icing on the cake
They also not only abstracted the modified pre-order tree, but materialized paths:Sometimes you may need to alter the data in the database with your models. Since you may create a table
or make a change, you have to do the data altering after the up() or down() method is processed. We have
hooks in place for this named preUp(), postUp(), preDown(), and postDown(). Define these methods and
they will be triggered after the migration version is executed.
http://www.doctrine-project.org/documen ... hical-data
Edit: Arboint is right, it only does nested sets, my mistake.. this thread is dead.
Last edited by josh on Sat Sep 27, 2008 3:34 am, edited 1 time in total.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: EAV attribtutes
Yes, Doctrine is awesome.jshpro2 wrote:I think Doctrine_Migration does everything I had in mind
and the icing on the cake
From my reading of those docs they only do nested set.jshpro2 wrote:They also not only abstracted the modified pre-order tree, but materialized paths:
http://www.doctrine-project.org/documen ... hical-data
(#10850)
Re: EAV attribtutes
I don't use a cache to get around performance at all. I thought my post was pretty clear.. my framework used with standard SQL has better performance than traditional table structure, and better again when using the data in a hash table.arborint wrote:Well ... we now know you use a cache to get around the performance issues. Not that I could understand it...powerofq wrote:I don't use the methods you've described, and not only is there no performance hit, when used in a simple hash table stored in memory, blows RDBMS away. I simply use MySQL for convenience, and even then it's faster than traditional table structure.
Re: EAV attribtutes
Of course lookups are going to be faster in a hash table then in a relational database. And why wouldn't you use a cache, most frameworks allow caching on all layers of the application ( data access, generated models, etc.. ), or maybe I'm misreading what you wrote since you said you didn't use a cache to "get around" the problem.
http://incubator.apache.org/couchdb/
Even if your idea had credit, which I'm not saying it doesn't, I would say it would be better packaged as a RDMBS and not a framework
Your AJAX stuff is also already implemented in 100s of other frameworks, if you believe in your own idea why not focus on that instead of re-inventing other wheels. If you're going to try to re-invent a wheel to make it round why try to also re-invent 10 other wheels?
http://incubator.apache.org/couchdb/
Even if your idea had credit, which I'm not saying it doesn't, I would say it would be better packaged as a RDMBS and not a framework
Your AJAX stuff is also already implemented in 100s of other frameworks, if you believe in your own idea why not focus on that instead of re-inventing other wheels. If you're going to try to re-invent a wheel to make it round why try to also re-invent 10 other wheels?
Last edited by josh on Tue Sep 30, 2008 12:54 pm, edited 1 time in total.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: EAV attribtutes
Yeah, you have been pretty clear. And I think I have also been pretty clear that I don't believe your boasts.powerofq wrote:I don't use a cache to get around performance at all. I thought my post was pretty clear.. my framework used with standard SQL has better performance than traditional table structure, and better again when using the data in a hash table.
(#10850)
Re: EAV attribtutes
Have I walked into a local PHP conference with exactly two other participants? I'm clearly in the wrong forum.
Re: EAV attribtutes
just went to your sitepowerofq wrote:Have I walked into a local PHP conference with exactly two other participants? I'm clearly in the wrong forum.
Code: Select all
<?
include "db.php";
function e($order){
$order = strtolower($order);
$order = str_replace(' ', '', $order);
$getI= mysql_query("select value from atoms where subject ='$order' and predicate= 'order'");
$getIr = mysql_fetch_row($getI);
Eval ($getIr[0]);
}
$subject = $_GET['k'];
$loginemail= $_COOKIE['lastuser'];
e('singlevalue');
e('vofsandp');
e('atomexists');
e('getsite');
$thehost = $_SERVER['HTTP_HOST'];
//$thehost = explode(".", $thehost);
//if((count($thehost)) > 2){$thehost = $thehost[1];} else { $thehost = $thehost[0]; }
//--------THE GRID ------------------
$firstdash = strpos($_REQUEST['k'], '-');
//if ($firstdash != false)
//{
$siteurl = str_replace('www.','',$thehost);
$siteurlsplit = split('\.',$siteurl);
$sitename = str_replace('-','', $siteurlsplit[0]);
$firstarg = substr($_REQUEST['k'], 0, $firstdash);
$defaultpage = $sitename.'-'.$_REQUEST['k'];
if (atomexists($defaultpage,'isa','page'))
{
$newsubject = $defaultpage;
} else if (atomexists($_REQUEST['k'], 'isa','page'))
{
$pagesite = getsite($_REQUEST['k']);
$thissite = getsite();
// make sure it belongs to the domain here when possible
if ($pagesite == $thissite || (!$pagesite) || (!$thissite))
{
$newsubject = $_REQUEST['k'];
} else {
die ('invalid page');
}
}
//die();
/*
echo getsite($newsubject);
if (atomexists($sitename,'isa','site'))
{
if (getsite($newsubject) != $sitename)
{
die("not on this site");
}
}
*/
$subject = $newsubject;
//}
//-----------------------SEO----------------------------------
$seosubject = $subject;
/*
if($thehost != "kommonwealth"){
//$hostsub = $thehost."*";
//$subject = str_replace($hostsub, '', $subject);
//$subject = $thehost."*".$subject;
$seosubject = $thehost."*".$subject;
}
*/
$seopagetitle ="$subject";
$seopagedesc = "";
$seopagekeywords ="kommonwealth redwerks social networking";
$allwidgets = vofsandp($seosubject, 'haswidget');
$noscriptcontent = '';
$rssno = 1;
$rssheader = '';
foreach($allwidgets as $widget)
{
//SEE IF WIDGET IS RSS -- add to header
$widgetorder = singlevalue($widget, 'widgetorder');
if($widgetorder == 'aggregator'){
$rssfeedurl = singlevalue($widget, 'feedurl');
$rssheader.= '<link rel="alternate" type="application/rss+xml" title="'.$subject.' '.$rssno.'" href="'.$feedurl.'"/>';
}
$content = singlevalue($widget, 'content');
$content = strip_tags($content);
$noscriptcontent.=$content."<br>";
}
$allarchivepages = vofsandp($seosubject, 'haspagearchive');
$pagearchivelinks = '';
foreach($allarchivepages as $archive){
$archivename = singlevalue($archive, 'name');
$pagearchivelinks.='<a href="'.$archive.'">'.$archivename.'</a><br>';
}
$seopagetitle = singlevalue($seosubject, 'seopagetitle');
$seopagedesc = singlevalue($seosubject, 'seopagedesc');
$seopagekeywords = singlevalue($seosubject, 'seopagekeywords');
$seokeywords = '<meta name="keywords" content="'.$seopagekeywords.'">';
$seodesc = '<meta name="description" content="'.$seopagedesc.'">';
/*
$journalentries = vofsandp($seosubject, 'journalentry');
$journals = '<h3>Journal</h3><br>';
foreach($journalentries as $journalentry){
$journaltitle = singlevalue($journalentry, 'journalmsgtitle');
$journalcontent = singlevalue($journalentry, 'content');
$journals.=$journaltitle."<br>".$journalcontent;
}
*/
//-----------------------GOOGLE ANALYTICS
//$googleanalytics = singlevalue($subject, 'googleanalytics');
$googleanalytics = '';
$cachedate = gmdate("D, d M Y H:i:s", time() + 172800) . " GMT";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<META HTTP-EQUIV="expires" CONTENT="<? echo "$cachedate" ?>">
<META http-equiv="X-UA-Compatible" content="IE=7" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title><? echo"$seopagetitle"; ?></title>
<? echo"$seodesc"; ?>
<? echo"$seokeywords"; ?>
<noscript>
<? echo "$pagearchivelinks"; ?>
<? echo "$noscriptcontent"; ?>
<? echo "$rssheader"; ?>
</noscript>
<? echo "$rssheader"; ?>
<style>
a{text-decoration: none;}
img{border-style: none;}
</style>
<script src="js/mootools.v1.00.js" type="text/javascript"></script>
<script src="js/redwerks.js" type="text/javascript"></script>
<script src="js/picker.js" type="text/javascript"></script>
<script type="text/javascript">
var timeouts= new Array();
function clearalltimeouts()
{
for (key in timeouts)
{
var hasit = key.indexOf('droptimeout');
if(hasit > -1)
{
clearTimeout(timeouts[key]);
}
}
}
</script>
<script>
function fadeout(el)
{
var fadez = new Fx.Style(el, 'opacity', {}).start(1,0);
}
function fadeoutin(el,html)
{
var fadez = new Fx.Style(el, 'opacity', {duration:2000,wait:false}).start(1,0);
}
</script>
<script>
var panel5;
</script>
<script>
function iframepanel(panelid, panelwidth)
{
$('iframepanelid').value = panelid;
$('iframepanelwidth').value = panelwidth;
command('iframepanelform');
}
</script>
<!-- EXPERIMENTAL -->
<script type="text/javascript">
var isCtrl = false;
document.onkeyup=function(e){
if(e.which == 17) isCtrl=false; }
document.onkeydown=function(e){
if(e.which == 17) isCtrl=true;
if(e.which == 81 && isCtrl == true) {
command('qform');
}
}
</script>
<style>
.tool-tip{
background-color:#FFF;
z-index:12000;
margin: 10px;
border: 1px solid #ccc;
}
.tool-text{
padding: 4px 8px 8px;
z-index:12000;
}
.tool-title{
color:#FFF;
}
</style>
<link rel="shortcut icon" href="favicon.ico" >
<!--
<script src="js/posteditor.js" type="text/javascript"></script>
<script src="js/language.FORUM.js" type="text/javascript"></script>
-->
<link rel="stylesheet" type="text/css" href="css/main.css" />
<script type="text/javascript">
/*<![CDATA[*/
function IEHoverPseudo() {
var navItems = document.getElementById("primary-nav").getElementsByTagName("li");
for (var i=0; i<navItems.length; i++) {
if(navItems[i].className == "menuparent") {
navItems[i].onmouseover=function() { this.className += " over"; }
navItems[i].onmouseout=function() { this.className = "menuparent"; }
}
if(navItems[i].className == "menuparent2") {
navItems[i].onmouseover=function() { this.className += " over"; }
navItems[i].onmouseout=function() { this.className = "menuparent2"; }
}
}
}
/*]]>*/
</script>
</head>
<body onload="command('loader');">
<div id="navbar" style='z-index:999;'>
<span id="buttonset"></span>
<span id='navbar2' style=''></span>
</div>
<form id="qform" action="commander.php">
<input type="hidden" name="order" value="q" />
</form>
<form id="pauseform" action="commander.php">
<input type="hidden" name="order" value="pause" />
<input type="hidden" name="pausetime" id="pausetime" />
</form>
<form id="jframechangeform" action="commander.php">
<input type="hidden" name="order" value="jframechange" />
<input type="hidden" name="jframe2change" id="jframe2change" />
<input type="hidden" name="page2change2" id="page2change2" />
</form>
<form id='loader' name='loader' action='commander.php'>
<input type='hidden' name='order' value="<?=$subject;?>" />
<input type='hidden' name='ordertype' value='page' />
<input type='hidden' name='security1' id='security1' />
</form>
<form id='iframepanelform' name='iframepanelform' action='commander.php'>
<input type='hidden' name='order' value='iframepanel' />
<input type='hidden' name='iframepanelid' id='iframepanelid' />
<input type='hidden' name='iframepanelwidth' id='iframepanelwidth' />
</form>
<form id='updateposform' name='updateposform' action='commander.php'>
<input type='hidden' name='order' value='updatepos' />
<input type='hidden' name='theDiv' id='theDiv' value='' />
<input type='hidden' name='widgetwidth' id='widgetwidth' value='' />
<input type='hidden' name='widgetheight' id='widgetheight' value='' />
<input type='hidden' name='xposval' id='xposval' value='' />
<input type='hidden' name='yposval' id='yposval' value='' />
</form>
<form id='editproform' name='editproform' action='commander.php'>
<input type='hidden' name='order' value='editpro' />
<input type='hidden' id='editprosubnpred' name='editprosubnpred' value='' />
<input type='hidden' id='editprovalue' name='editprovalue' value='' />
</form>
<form id='editcform' name='editproform' action='commander.php'>
<input type='hidden' name='order' value='editc' />
<input type='hidden' id='editcsub' name='editcsub' value='' />
<input type='hidden' id='editcvalue' name='editcvalue' value='' />
</form>
<form id="check4messgesform" action="commander.php">
<input type="hidden" name="order" value="check4messages" />
</form>
<form id="forgotpasswordform" action="commander.php">
<input type="hidden" name="order" value="sendforgotpassword" />
</form>
<form id="controlpanelform" action="commander.php">
<input type="hidden" name="order" value="controlpanel" />
<input type="hidden" id="controlpanelwid" name="widgetid" />
</form>
<form id="pollingmanagerform" action="commander.php">
<input type="hidden" name="order" value="pollingmanager">
</form>
<div style="position:absolute;top:56px;z-index:999;left:0px;cursor:pointer;">
<div id="panel1" style="
width:190px;
height:180px;
border: 1px solid #ccc;
background:url(img/200grad.png) repeat-x;
color:#333;
left:0px;
padding:5px;"/>
<center>
<form id='loginform' action='commander.php'><b>Please sign in:</b><br />
Email<br>
<input type="text" name="id" value="<?=$loginemail?>" /><br />
Password<br> <input type='password' name='password' />
<input type='hidden' name='order' value='login' /><span id="loginresponse"></span><br />
<input name='sendbutton' type='button' value='submit' onClick="command('loginform');">
</form> <br>
<br> <a href="#" onclick="command('forgotpasswordform');return false;">Forgot your password?</a><br>
or <a href='join'>Join</a>
</center>
</div>
</div>
<div style="position:absolute;top:0px;z-index:10000;left:0px;cursor:pointer;">
<div id="panel2" style="
width:150px;
height:100%;
background-color: #FFF;
background-repeat: no-repeat;
color:#777;
left:10px;
padding:10px;
font-size: 14px;
"/>
</div>
</div>
<div style="position:absolute;top:57px;z-index:999;left:0px;">
<div id="panel3" style="
width:1000px;
height:1000px;
background-color:white;
color:#000;
left:0px;
border-right: 2px #ccc solid;
border-bottom: 2px #ccc solid;
"/>
<div style="position:relative;top:0px;height:103px;width:100%;background:url(img/subpan3slice.png) repeat-x;">
<div style="float:right;position:relative;top:0px;margin-right:2px;">
<img src="img/controlpanelclose.png" style="cursor:pointer;z-index:999;" onclick="panel3.slideOut();" />
</div>
</div>
<div id="panel3content"></div>
</div>
</div>
<script type="text/javascript">
window.onload = function() {
command('loader');
mySlider2 = new Fx.Slide('panel1', {
duration: 500,
mode:'horizontal'
});
mySlider2.hide();
panel3 = new Fx.Slide('panel3', {
duration: 750,
mode:'horizontal',
transition: Fx.Transitions.quartInOut
});
panel3.hide();
response = new Fx.Slide('panel2', {
duration: 500,
mode:'horizontal'
});
response.hide();
}
</script>
<?=$googleanalytics?>
<div id="temp"></div>
</body>
</html>
I was also able to view your database connection script source-code, might want to configure your server before you worry about design principles.
Ah line 10, the patented secret to the framework.. now its out in the open
That code also does not follow MVC or any other design pattern that I can recognize, theres no separation of application logic and design
Re: EAV attribtutes
So you stumbled upon my development server while I was reconfiguring PHP to work with a new web server we've developed (running now), and managed to expose some old code that's getting sourced anyway. And then feel to post it here? You must be some kind of l33t hax0r huh? The code you're looking has little to do with anything. Line 295 might clue you in a bit.jshpro2 wrote:
Ah line 10, the patented secret to the framework.. now its out in the open
That code also does not follow MVC or any other design pattern that I can recognize, theres no separation of application logic and design
As for eval, does that scare you? Do you think I'm evaluating "arbitrary code"? I might understand if you argued a possible performance hit, but this 'all eval is evil' paranoia is unfounded. It's what you do with it that makes it insecure.. and in that sense, I suggest you avoid it.
Why don't you post some links to your websites here, then we'll have a little discussion on security.
Re: EAV attribtutes
So your framework is built in javascript, instead of generating javascript the framework is written in it? what happens when javascript is replaced with something superior?, anyways I didn't post any proprietary trade secrets of yours that you haven't already told us about or anything so calm down
in most cases javascript should be implemented as a view, in a sever centric application design, you could have a framework to generate that view but where does your domain model exist, in the client or in the server?
in most cases javascript should be implemented as a view, in a sever centric application design, you could have a framework to generate that view but where does your domain model exist, in the client or in the server?
- allspiritseve
- DevNet Resident
- Posts: 1174
- Joined: Thu Mar 06, 2008 8:23 am
- Location: Ann Arbor, MI (USA)
Re: EAV attribtutes
@jshpro2, have you made any headway on this project?
Re: EAV attribtutes
Actually, I like doctrines migrations implementation. I decided I want to borrow a lot of their code base, but then also port a lot of hybernates behavior to it and make it follow a data mapper pattern instead of active record. I couldn't find an ORM that handled polymorphic associations, I like hybernates XML metadata mappers, they seem to support mapping a lot richer design to the relational database, for instance the ability to define custom discriminator fields, support of all 3 class inheritance table patterns from POEAA, along with a 4th. Even if I could just port some of that ( I don't like the idea of criterion objects or whatever, and doctrine already provides a sufficient query object to use ), like I said in another thread though I'm busy learning TDD, waiting on amazon to ship me Fowler's book.
I'm just torn on using EAV for a custom fields solution ( I understand why EAV has its time and place ). It seems to defeat the purpose of the database for a store, if you keep your data relational you can just add views and indexes on the fly
I'm just torn on using EAV for a custom fields solution ( I understand why EAV has its time and place ). It seems to defeat the purpose of the database for a store, if you keep your data relational you can just add views and indexes on the fly
- allspiritseve
- DevNet Resident
- Posts: 1174
- Joined: Thu Mar 06, 2008 8:23 am
- Location: Ann Arbor, MI (USA)
Re: EAV attribtutes
That's an excellent idea.jshpro2 wrote: like I said in another thread though I'm busy learning TDD