how can i using common sense, or that objects model the real world understand how doctrine determines which side is owning or inverse and how relationships are uni/bi-directional?
say from the doctrine sandbox. 1 user has 1 address. i guess since user owns the house/address, user is the owning side?
The owning side of a relationship...
I stumbled upon a very strange bit of PHP code. Could someone explain why this is happening? **BONUS POINTS** if you can tell my why this is useful.
<?php
if(0=='a'){
print ord(0)." should NEVER equal ".ord('a')."<br>";
}
if(false==0){
print "false==0<br>";
}
if('a'==false){
print "a==false<br>";
}
?>
And the resu...
In implementing the backup script I described in this serverfault question, I ran into some timeout issues that have prompted optimizations to the code (namely, backing up one file per execution of the script and doing everything I can to minimize the number of file-hashes I am calculating over the very large data files).
So far, that ...
Referencing doctrine reference - one to many unidirectional
class User
{
// ...
/**
* @ManyToMany(targetEntity="Phonenumber")
* @JoinTable(name="users_phonenumbers",
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="phonenumber_id", referencedColumn...
I want to create a PHP function that goes through a website's homepage, finds all the links in the homepage, goes through the links that it finds and keeps going until all the links on said website are final. I really need to build something like this so I can spider my network of sites and supply a "one stop" for searching.
Here's what...
Question:
What is best practice for form submissions while keeping in mind security?
This may be a n00b question but I'm concerned that people might be able to alter some data as its being submitted. Take my example:
I have a form that has a hidden input that stores a user's unique Facebook ID. I take that Facebook ID and create a use...
How can I add index to an 18 GB innodb mysql table without affecting the production performance? The table is frequently accessed, I tried altering the table just now and it turns up to have locked more than 200 queries out, and that's bad for performance. Are there any other ways to do it?
...
referencing doctrine reference - association mapping - many to many bidirectional
/** @Entity */
class User
{
// ...
/**
* @ManyToMany(targetEntity="Group", inversedBy="users")
* @JoinTable(name="users_groups",
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinC...
what are these called \r \n and is there a tutorial that explains them?
...
hello,
i have fedora 13, and i have installed httpd,php,mysql using yum.
then downloaded mongodb.
added the extension=mongo.so to my php.ini
restarted httpd
wrote the following code :
<?php
$connect = new mongo();
$db = $connect->data;
$collection = $db->foobar;
$info = array("name" => "wael", "age" => 24);
$collection = insert($info...
Hi,
I have a simple HTML form that posts to a PHP page, which will then return the user some content. I want to take this PHP code and get my wordpress theme to wrap around it, so that appears like a normal page on my site. Can't find any resources on this - where do I begin?
Thanks.
...
Please help. I need randomly generate an 2 dimensional nXn array .
lets take for now n=10;
array should have such structure. one example
$igra[]=array(0,1,2,3,4,5,6,7,8,9);
$igra[]=array(6,9,1,5,0,2,7,3,4,8);
$igra[]=array(2,5....................
$igra[]=array(1,7.....................
$igra[]=array(5,4...................
$igra[]=arr...
I have a news script. This script works like the following:
I enter the news details from a form
The news is inserted into the database
The news is displayed to the visitor
I need to display the latest 4 news only, not all news entries. How can I do this?
...
I have txt file with email addresses under under the other like :
[email protected]
[email protected]
So far I managed to open it with $result = file_get_contents("tmp/emails.txt"); but I don't know to to get the email addresses in an array. Basically I could use explode but how do I delimit the new line ?
thanks in advance for any answer ...
Basically I have a foreach loop in PHP and I want to:
foreach( $x as $y => $z )
// Do some stuff
// Get the next values of y,z in the loop
// Do some more stuff
...
It's as easy as the title sounds; I need to get the index/key of the last inserted item. Why is this difficult? See the following two code samples:
$a=array();
echo 'res='.($a[]='aaa').' - '.(count($a)-1).'<br>';
echo 'res='.($a[]='bbb').' - '.(count($a)-1).'<br>';
echo 'res='.($a[]='aaa').' - '.(count($a)-1).'<br>';
die('<pre>'.print_r...
What is best for storing passwords? Should I be Encrypting or hashing password for you users table ?
What do you prefer, and why? Could you please provide an example of secure password storage.
...
Consider the following array:
/www/htdocs/1/sites/lib/abcdedd
/www/htdocs/1/sites/conf/xyz
/www/htdocs/1/sites/conf/abc/def
/www/htdocs/1/sites/htdocs/xyz
/www/htdocs/1/sites/lib2/abcdedd
what is the shortest and most elegant way of detecting the common base path - in this case
/www/htdocs/1/sites/
and removing it from all elements...
Hi,
Im trying to create a simple image resize feature, can you tell me where i'm going wrong:
//resize image
$imageSrc = imagecreatefromjpeg('http://www.katsmurals.com/cms/'.$target_path);
$width = imagesx($imageSrc);
$height = imagesy($imageSrc);
echo $width;
echo $height;
//new dimensions
$i = $width;
$j = $height...
I have a block that I want to show edit and delete buttons for users with access, and other buttons for the rest of the users. This is the script I'm using for the users with update permission:
<?php
if(arg(0) == 'node' && is_numeric(arg(1))){
//load $node object
$node = node_load(arg(1));
//check for node update access
...