symfony1

Symfony admin generator : add user id before saving

时光怂恿深爱的人放手 提交于 2019-12-19 10:35:12
问题 I'm creating my own blog engine to learn Symfony, and I have a question : In the generated administration pages for a blog post, I have a drop-down list of authors, to indicate the author_id. I'd like to hide that drop-down list, and set the author_id to the id of the current logged-in user when the post is created (but not when it is edited) How can I accomplish that ? Edit I've tried those : $request->setParameter(sprintf("%s[%s]", $this->form->getName(), "author_id"), $this->getUser()-

Easy to use/learn PHP framework? [closed]

拟墨画扇 提交于 2019-12-18 12:37:15
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I need to build a php app, and I was thinking about using a framework (never used one before). I've been browsing around some but most of them seems kinda complicated, I really liked what I saw about Symfony, but it looks like I will have to spend like a month until I really understand how to use it, and in one

Java 1.6 Broken when called by background Symfony task

戏子无情 提交于 2019-12-18 12:13:41
问题 I have a Symfony task that generates some files calls exec to a jar and then parses the output. The jar runs fine from the command line, the task runs fine from the command line. The problem: I call the task in an action based on a form submission. I have the action start a new php process in the background to run the task regardless of what the page the spawned it does now. When it gets to the java call, say exec(java -version); it outputs this: Error occurred during initialization of VM

How do I correctly install PHPUnit with PEAR?

对着背影说爱祢 提交于 2019-12-18 10:33:16
问题 I have had to de- and reinstall a newer version of PHPUnit following these directions. Now when I'm launching this line sudo pear install --alldeps phpunit/PHPUnit I see an error message, that looks like this. Unknown remote channel: pear.symfony.com phpunit/PHPUnit requires package "channel://pear.symfony.com/Yaml" (version >= 2.1.0) No valid packages found If I install just Yaml by launching sudo pear install symfony/YAML an older version (1.0.6) will be installed that doesn't meet the

How should be kept as HTML tags in database?

你离开我真会死。 提交于 2019-12-18 09:22:54
问题 i create my new site. Now i learn and use Symfony. I have few questions. Why default Symfony allow add HTML tags to database? For example i create new module, i go to module/new, in title i enter <strong>test</strong> and next save it. In database MySQL i have <strong>test</strong> . Is it safe? I know - if i use simply $test->getTitle() then this render text <strong>test</strong> , but what if i would like add for user comments WYSYWIG and use RawValue()? Users can not close tags </strong>

how to remove html tags in php?

青春壹個敷衍的年華 提交于 2019-12-18 06:48:22
问题 i posted some data using tinymce (in a symfony project).while retrieving back how can i remove html tags? strip_tags not working.. 回答1: The easies way is to use strip_tags but it's not very reliable. There is a very, very, VERY good project design specifically for this: HTML Purifier . It battle-hardened, tested and very good. strip_tags is the easy, fast and go way, but it can miss out some malformated html that a browser will actually parse and execute. Please, don't use regular expression

Can I use Facebook's hiphop with frameworks like Zend Framework, cakephp, symfony

两盒软妹~` 提交于 2019-12-18 03:33:41
问题 Yesterday Facebook launched HipHop, a sourcecode-converter from php to c++. The set of php functions and constructions is more limited than in standard php. Are the current popular php frameworks (ZF, CakePHP, symfony) compatible with HipHop? If not, which parts of these frameworks are not usable? 回答1: If I'm not mistaken, HipHop has not been released yet -- even the wiki page linked from the Facebook annoucement yesterday is not up yet. So, it's going to be a bit hard to answer, right now. I

Can I use Facebook's hiphop with frameworks like Zend Framework, cakephp, symfony

折月煮酒 提交于 2019-12-18 03:33:17
问题 Yesterday Facebook launched HipHop, a sourcecode-converter from php to c++. The set of php functions and constructions is more limited than in standard php. Are the current popular php frameworks (ZF, CakePHP, symfony) compatible with HipHop? If not, which parts of these frameworks are not usable? 回答1: If I'm not mistaken, HipHop has not been released yet -- even the wiki page linked from the Facebook annoucement yesterday is not up yet. So, it's going to be a bit hard to answer, right now. I

symfony redirect with 2 parameters

社会主义新天地 提交于 2019-12-17 17:48:18
问题 how can i redirect to another action passing 2 or more parameters? this code: $this->redirect('input/new?year=' . $year . '&month=' . $month); results in URL: http://.../input?year=2009&month=9 回答1: Well, that's normal, "redirect" redirect to an absolute URL. You can do that: $this->redirect($this->generateUrl('default', array('module' => 'input', 'action' => 'new', 'year' => $year, 'month' => $month))); 回答2: In currently supported Symfony versions (2.7+) it's even easier: return $this-

What is the safest way of passing arguments from server-side PHP to client-side JavaScript [duplicate]

江枫思渺然 提交于 2019-12-17 10:59:25
问题 This question already has answers here : How do I pass variables and data from PHP to JavaScript? (20 answers) Closed 5 years ago . In my application I rely heavily on JavaScript to enhance the user interface, but all of the data comes from a database and is processed by PHP. By default I use 'echo' statements to substitute the required values "just in time" like so: var myVariable = <?php echo $myVariableInPHP ?> This, however, does not strike me as very elegant and I am concerned about