嗨,大家好,我只是在子表中创建父表的外键引用.当我尝试从父表中删除其子表中引用的行时,令人惊讶的是它允许我删除它.我试图通过写删除限制来创建子表,也没有它但没有帮助.任何想法为什么会这样?.Below是我在创建表时使用的代码.
CREATE TABLE region
(
id int PRIMARY KEY AUTO_INCREMENT,
name varchar(50) NOT NULL
);
CREATE TABLE aggregator
(
id int PRIMARY KEY AUTO_INCREMENT,
name varchar(50) NOT NULL
);
CREATE TABLE gateway
(
id int PRIMARY KEY AUTO_INCREMENT,
name varchar(50) NOT NULL,
region_id int ,
aggregator_id int ,
is_public boolean DEFAULT 0 NOT NULL,
FOREIGN KEY (region_id) REFERENCES region(id),
FOREIGN KEY (aggregator_id) REFERENCES aggregator(id)
);
Run Code Online (Sandbox Code Playgroud) 我想知道为什么$(this)不按照我期望的方式工作?在下面的代码中,单击"删除图像"时没有任何反应.如果您注释掉确认语句,则单击"删除图像"时背景将变为绿色.你知道为什么吗?$(this)由于确认声明,它似乎指向其他东西.提前致谢!
<a href="#" class='thumbnail the-one delete-file'><i class="icon-remove"></i>Remove Image</a>
$('.the-one').click(function(){
if(confirm("What do you say?")) { return true;} else {return false;}
$(this).css("background", "green");
});
Run Code Online (Sandbox Code Playgroud) 我有很长的字符串
"When I was 10 year old"
Run Code Online (Sandbox Code Playgroud)
我必须将此字符串拆分为数组:["When I was", "10" , "year old"].
在不同情况下整数可以不同,并且句子也可以改变.
简而言之,我希望将整数字符串拆分为可能吗?
我怎样才能在Jquery/java-script中使用正则表达式与split进行共轭
我在下面有一个小代码片段
var foo = {
bar: function () {
return this.baz;
},
baz: 1
};
(function () {
return typeof arguments[0]();
})(foo.bar);
baz = 1;
//result undefined
Run Code Online (Sandbox Code Playgroud)
当foo.bar函数执行时,this指的是窗口范围,当然baz我baz=1在窗口中定义了什么.但该计划仍然没有工作和返回undefined.为什么它返回undefined时baz在窗口定义,我从窗口执行foo.bar
假设在我的系统中有四个用户角色 -
1. ROLE_SUPER_ADMIN
2. ROLE_ADMIN
3. ROLE_EDITOR
4. ROLE_AUTHOR
Run Code Online (Sandbox Code Playgroud)
现在想想,一个用户拥有角色 ROLE_AUTHOR。他可以访问特定文档,但其他用户无法访问该文档。所以我只想允许拥有ROLE_AUTHOR. 我在搜索时得到了一些解决方案,其中有类似的内容,
is_granted('ROLE_AUTHOR')但这会返回分层结果。因为在我的配置文件中我设置了层次结构。那么我怎样才能只授予ROLE_AUTHOR用户权限呢?
在Symfony2中,我看到了如下代码:
if (null === $this->rootDir) {
$r = new \ReflectionObject($this);
$this->rootDir = dirname($r->getFileName());
}
Run Code Online (Sandbox Code Playgroud)
为什么不只是使用__DIR__?
if (null === $this->rootDir) {
$this->rootDir = __DIR__;
}
Run Code Online (Sandbox Code Playgroud)
他们之间有什么区别?
我正在遵循symblog symfony2教程的第5部分:
http://tutorial.symblog.co.uk/docs/customising-the-view-more-with-twig.html
Run Code Online (Sandbox Code Playgroud)
标题下:主页 - 博客和评论
当我得到更新时:
// src/Blogger/BlogBundle/Repository/BlogRepositoy.php
public function getLatestBlogs($limit = null)
{
$qb = $this->createQueryBuilder('b')
->select('b, c')
->leftJoin('b.comments', 'c')
->addOrderBy('b.created', 'DESC');
if (false === is_null($limit))
$qb->setMaxResults($limit);
return $qb->getQuery()
->getResult();
}
Run Code Online (Sandbox Code Playgroud)
当我更新时:
{# src/Blogger/BlogBundle/Resources/views/Page/index.html.twig #}
{# .. #}
<footer class="meta">
<p>Comments: <a href="{{ path('BloggerBlogBundle_blog_show', { 'id': blog.id }) }}#comments">{{ blog.comments|length }}</a></p>
<p>Posted by <span class="highlight">{{ blog.author }}</span> at {{ blog.created|date('h:iA') }}</p>
<p>Tags: <span class="highlight">{{ blog.tags }}</span></p>
</footer>
{# .. #}
Run Code Online (Sandbox Code Playgroud)
我然后刷新我的浏览器并得到错误:
[Semantical Error] line 0, col 71 near …Run Code Online (Sandbox Code Playgroud) httpd.conf(/etc/httpd/conf/httpd.conf)和ssl.conf(/etc/httpd/conf.d/ssl.conf)文件有什么区别?
我正在尝试在我的网站上设置ssl,发现这些文件有类似的令牌.
任何帮助,将不胜感激.
我需要从MySQL表中获取最接近当前日期的日期.
这是我的表:
id | date | name
1 | 2012-10-29 | test
2 | 2009-11-31 | test
Run Code Online (Sandbox Code Playgroud)
因此,如果查询今天运行,它将返回 1 | 2012-10-29 | test
任何帮助深表感谢.谢谢
我是Jquery的新手,我的要求是将两个段落合并为单个段落.我尝试使用以下代码.
<p>This is first para text </p>
<p>This is second para text </p>
<p>This is third para text.</p>
Run Code Online (Sandbox Code Playgroud)
成
<p>This is first para text This is second para text This is third para text.</p>
Run Code Online (Sandbox Code Playgroud)
它不起作用.有任何想法吗?
php ×4
javascript ×3
jquery ×3
symfony ×3
mysql ×2
apache ×1
arguments ×1
date ×1
doctrine-orm ×1
function ×1
httpd.conf ×1
regex ×1
sql ×1
ssl ×1